Quantcast
Channel: SQL Server Analysis Services forum
Viewing all 14337 articles
Browse latest View live

Getting measure count from the different memebrs of the same dimenstion

$
0
0

Hi All, I am new with MDX. here I have to get the measure counts to fulfill the venn diagram for this I would get 3 parameters from the UI.

how can i get all the 3 combination of Dimensions Measure count in MDX. In the Below image I'm getting individual members measure count but how can i get combination of members measure count. Say for example i have got the individual members count for 262,210 and 198 DrKey's [DimPopulation] Dimension.I would need members count combination like  1) 262 and 210 along with measure count  2) 262 and 198along with measure count  3) 198and 210 along with measure count  4) 262,210 and 198 along with measure count to full fill the venn diagram . I also tried with the below query it gives individual members count but not giving combination of members of count. Can any one help me out.

image path (//social.msdn.microsoft.com/Forums/getfile/576938)

WITH

MEMBER DrKeyAS

    [DimPopulation].[Population Key].

CurrentMember.Member_Key

 

MEMBER [262and210]AS

   

Sum


    (

      [DimPatient].[Patient Key].[Patient Key].

MEMBERS


     ,

IIF


      (

          (

            [Measures].[DrPatientKeyCnt]

           ,{

              [DimPopulation].[Population Key].&[262]

             ,[DimPopulation].[Population Key].&[210]

            }

          )

        <> 0

       ,1

       ,

NULL


      )

    )

 

MEMBER [262]AS

   

Sum


    (

      [DimPatient].[Patient Key].[Patient Key].

MEMBERS


     ,

IIF


      (

          (

            [Measures].[DrPatientKeyCnt]

           ,[DimPopulation].[Population Key].&[210]

          )

        <> 0

       ,1

       ,

NULL


      )

    )

 

MEMBER [210]AS

   

Sum


    (

      [DimPatient].[Patient Key].[Patient Key].

MEMBERS


     ,

IIF


      (

          (

            [Measures].[DrPatientKeyCnt]

           ,[DimPopulation].[Population Key].&[210]

          )

        <> 0

       ,1

       ,

NULL


      )

    )

 

MEMBER [198]AS

   

Sum


    (

      [DimPatient].[Patient Key].[Patient Key].

MEMBERS


     ,

IIF


      (

          (

            [Measures].[DrPatientKeyCnt]

           ,[DimPopulation].[Population Key].&[198]

          )

        <> 0

       ,1

       ,

NULL


      )

    )


SELECT

  {

    DrKey

   ,[Measures].[DrPatientKeyCnt]

   ,[262and210]

   ,[210]

   ,[198]

   ,[262]

  }

ONCOLUMNS

FROM

[PopulationReportCube]


WHERE

  (

    [DimAnchorDate].[Date Key].&[20141031]

   ,[DimReport].[Report Key].&[1]

  );

 

 

 

 



Dimension setup

$
0
0

Hi,

I'm not an expert on SSAS cubes and trying to find a solution for a little problem we have.

We have a project dimension which also holds the projectid of it's toplevel project.

This is not his parent project but could be several levels higher.

For certain purposes, we want to recover some data from the toplevel project.

This means somehow copying the existing Project Dimension and linking it to the existing Project Dimension through the toplevelprojectid field.

But I have no clue how to achieve this, does anybody have an article.tutorial which covers this kind of use?

Worst case scenario, we would add the toplevelprojectid field in the measures, but that's not very efficient I think.

This means changing 15 measure tables, which is a lot of work.

Greetings from Belgium,

Sven Peeters

Errors connecting to an offline cube (.cub) file

$
0
0

I am trying to execute a C# project that creates a local cube (.cub) file and processes data taken from an existing processed cube on Analysis Services 2012.

The project runs correctly when I use a connection string that points (and hence writes) to another database on Analysis Services. But when I execute the project using the following connection string that points to the local cube file to be created, it gives me error: 

conn.ConnectionString =
    string.Format( "Provider=MSOLAP;Data Source={0}", "c:\\output\\mycube.cub" );


When referenced to ADOMD 11 library, I get the following errors:

1. OLE DB error: OLE DB or ODBC error: A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.; 08001; Client unable to establish connection; 08001; Encryption not supported on the client.; 08001.

2. Errors in the high-level relational engine. A connection could not be made to the data source with the DataSourceID of 'DB_NAME', Name of 'DB_NAME'.

When referenced to ADOMD 12 library, I get the following error:

A connection cannot be made. Ensure that the server is running.

Although, I know SQL Server Analysis Services are running in services.msc.


MDX query to get negative measures

$
0
0
I need to query a cube with all negative values, unfortunately I'm new to MDX and find the syntax very alien compared toSQL.

I want to get the sum of all negative values from the database.

SQL would be:

SELECT Desk,Rating_Group, SUM(Value)
FROM fact
WHERE SUM(Value)<0
GROUP BY Desk,Rating_Group

I've tried various ways to get the data, but the aggregation does not appear to be correct.

MDX:
WITH MEMBER [Measures].[Long] AS
IIF(
[Measures].[Risk Value]<0,
[Measures].[Risk Value],
NULL)


SELECT NON EMPTY { [Measures].[Long]} ON COLUMNS,
NON EMPTY { ([Vdim Curve Family].[Hierarchy].[SP Rating Group]*[Vdim Book].[Desk].[Desk].Members) }
ON ROWS
FROM [DM]

What appears to be happenning is that the data is being pre-aggregated, so it returns the equivalent of the SQL

SELECT Desk,Rating_Group, SUM(Value)
FROM fact
GROUP BY Desk,Rating
HAVING SUM(Value)<0

I've also tried filter, aggregate,sum and all appear to give me the same problem.

Comments gratefully received, thanks if anyone can enlighten me.

I'm considering going back to the view that builds my cube and changing it and adding a new measure, but it seems over the top for something which is so easy in SQL.

How to restrict prevmember function to calculate for a particular year

$
0
0

Hi,

I have a MDX query that calculates the cumulative sum, using current & previous member. Now when year is January, i want the query to ignore prevmember value. Can somebody please help how this can be achieved?

My query:

CASE WHEN
((
   [Date].[CALENDAR].PrevMember
     ,[Measures].[TOTAL KM]
    )  + [Measures].[TOTAL KM] )=0 THEN 0 
ELSE
((
   [Date].[CALENDAR].PrevMember
     ,[Measures].[Number of Events]
    )  + [Measures].[Number of Events]) * 200000/
((
   [Date].[CALENDAR].PrevMember
     ,[Measures].[TOTAL KM]
    )  + [Measures].[TOTAL KM] ) END

MDX Query:-Latest Month for a particular year filter

$
0
0

Hi,

I have a report as follows:-

Filter:- Year

Measure|Month

[xyz]|[ Lastest Month for the particular year for which data is present.]

eg:- if it is the current year then

FY 2014-15  -->

111111 |Nov'14

if the previous year is selected in the filter then

FY 2013-14

2222222|Mar'14 and so on.

In short if it is the previous year than it should be the last month of that particular year and if it is the current year than the measure and month should be till the last month for which data exists. I am new to MDX query language .A little help in working this out is highly appreciated.


Thanks in Advance.


Leaves in calculation scope

$
0
0

Hello Guru's

I have a below scope in olap calculation tab.

([Measures].[X],leaves([DateDim]))
= aggregate([DateDim].[Calendar - Monthly].Currentmember.Parent.Prevmember.LastChild,[Measures].[Y]);

 

The question here is,when run below query as you see in the quarter level.

SELECT {
[Measures].X]} ON 0,

[DateDim].[Calendar - Monthly].[Quarter].&[201407] ON 1

from ....

it shows me value of

( [DateDim].[Calendar - Monthly].[Month].&[201408],[Measures].[Y] )  in a month level.  

 

But i would expect,this value should have

[DateDim].[Calendar - Monthly].[Quarter].&[201310],[Measures].[Y]

So what did i miss ?

Thanks in advance

 

 

 

 

 

Time dimension with hour granularity

$
0
0

I have a Date dimension with DAY granularity and Time dimension with HOUR granularity.

The Date dimension was created using SSAS Dimension Wizard and uses a DATETIME key as the PK, for example:

2014-01-01 00:00:00.000.

As we use the SSAS dimensions wizard, we cannot choose a surrogate key for our Date dimension.

The Time dimension was created using a simple TSQL script and uses an INTEGER surrogate PK, with a TimeAlternativeKey for holding the actual Time, for example:

01:00:00

Currently, the TimeAlternativeKey is VARCHAR as the surrogate key will be used for the fact table.

Our aim is to use both the Date and Time dimensions for a fact table, which requires analysis by hour, day, week, month and year.

- For rollup and drilldown analysis, should the Date dimension PK be DATE and the Time dimension PK be TIME?

If yes, we therefore cannot use the SSAS Dimension Wizard and we must use TSQL for our Date dimension.

- If our Time dimension contains hour values only, do we require the INTEGER surrogate key or can we use the actual hour value as the PK?

Is it better to have have the actual Date and Time as PK's in our dimensions or have surrogate keys for both?


TopCount in Cube not the same as TopCount in Excel

$
0
0
 I was reading a post on https://sqldusty.wordpress.com/tag/dynamic-named-set/ and my issue is I don't get the same results if I build a TopCount in the Cube compare to users doing filtering on the Top in MS Excel using pivot table connecting to the same cube.
Quick sample adventure works
In Adventure works cube you will find this dynamic set

CreateDynamicSetCurrentCube.[Top 25 Selling Products]

AsTopCount

    (

       [Product].[Product].[Product].Members,

       25,

       [Measures].[Sales Amount]

    )

,

Display_Folder ='Sets'

and if you connect to the cube via Excel and drop Sales amount and product on the pivot table then do a filter of Top 25 on sale amount you get the same exact data sets, which is what you would expect.

But if you add say "Sales Territory Country" from  Sales Territory dimension to the Top 25 Selling Products measure doesn't have 25 products for Australia while doing the filter on the excel side via pivot table does have 25 products for Australia.

So this beg the question how can you someone accomplish a Top X Client but still be able to add more Dimensions on top via Excel? So if I want to see Top 10 Client by sales amount I can write that in MDX in the CUbe side. But then the user wants to slice it by say territory so they want to know the top 10 clients by sales amount for each territory. How can that be done?

Kind of the same in adventure works it has the Top 25 selling Products which is the Top 25 products by sales amount. What if users wanted to see the Top 25 selling products for each territory. Does that mean a new Dynamic set is needed? cause having the Dynamic set of "Top 25 Selling Products" and dropping Sales territory on the pivot doesn't work as above.

Basically I would like to know how you can create a TOP X measure in the Cube but be able to change the slicers or dimensions dynamically as users slice by different dimensions via Excel pivot. Kind of in a way mimic what excel does when you create a filter for Top X for what ever dimension then a user adds another dimension by simply dropping it on top of the pivot.

AMO .NET An unexpected error occurred (file 'pcserialize.cpp', line 336, function 'PCBindableDataItem::Serialize').

$
0
0

Hello everyone,

I'm trying to create relationships for a Tabular Model using AMO .NET and the AMO2Tabular codeplex project.

Before this problem I was facing a "duplicate values" error message because my PK column wasn't Key type but Regular, then I found below link and I implemented the method to update PK column as a Key:

http://technet.microsoft.com/en-us/library/hh230844.aspx

Now I'm able to create some relationships, but some of them fail with below error message AMO .NET An unexpected error occurred (file 'pcserialize.cpp', line 336, function 'PCBindableDataItem::Serialize').

I don't understand what is this error about but it's happening whenever I try to updated the Measure Group right after I add a Reference Measure Group Dimension

 //  Creating the ReferenceMeasureGroupDimension that defines the 'Activeness' of a relationship
            using (AMO.Cube modelCube = tabularDatabase.Cubes[0])
            using (AMO.MeasureGroup currentMG = modelCube.MeasureGroups[currentMeasureGroupId])
            using (AMO.ReferenceMeasureGroupDimension newReferenceMGDim = new AMO.ReferenceMeasureGroupDimension())
            {
                newReferenceMGDim.CubeDimensionID = pkTableId;
                newReferenceMGDim.IntermediateCubeDimensionID = foreignTableId;
                newReferenceMGDim.IntermediateGranularityAttributeID = foreignColumnId;
                //  Replicating attributes (columns) from dimension
                foreach (AMO.CubeAttribute PKAttribute in modelCube.Dimensions[pkTableId].Attributes)
                {
                    using (AMO.MeasureGroupAttribute PKMGAttribute = newReferenceMGDim.Attributes.Add(PKAttribute.AttributeID))
                    using (AMO.DataItem dataItem = new AMO.DataItem(pkTableId, PKAttribute.AttributeID, PKAttribute.Attribute.KeyColumns[0].DataType))
                    using (AMO.ColumnBinding columnBinding = new AMO.ColumnBinding(pkTableId, PKAttribute.AttributeID))
                    {
                        PKMGAttribute.KeyColumns.Add(dataItem);
                        PKMGAttribute.KeyColumns[0].Source = columnBinding;
                    }
                }
                newReferenceMGDim.Attributes[pkColumnId].Type = AMO.MeasureGroupAttributeType.Granularity;

                //  If relationship is not null or empty then this is a direct relationship and
                //  has to have Materialization.Regular
                if (!relationshipId.IsNullOrEmptyOrWhitespace())
                {
                    newReferenceMGDim.Materialization = AMO.ReferenceDimensionMaterialization.Regular;
                    newReferenceMGDim.RelationshipID = relationshipId;
                }
                else
                {
                    newReferenceMGDim.Materialization = AMO.ReferenceDimensionMaterialization.Indirect;
                }

                //  Adding the ReferenceMeasureGroupDimension to the measure group
                currentMG.Dimensions.Add(newReferenceMGDim);
                currentMG.Update(AMO.UpdateOptions.ExpandFull, AMO.UpdateMode.UpdateOrCreate);
                currentMG.Process(AMO.ProcessType.ProcessFull);
            }

Code above was taken from AMO2Tabular project, AMO2Tabular.RelationshipFunctions.cs

As I mentioned before, this error is happening sometimes, not for all dimensions.

Thanks.



Ricardo Barona Application Developer

Analysis Service Database missing post reboot

$
0
0

Hi
Post recycle of Analysis Service we found one of the database went missing. So we tried attaching it from the local folder. But its failing with below error:

The detach log '\\?\E:\SalesCube_Monthly.0.db\SalesCube_Monthly.detach_log' could not be found in the specified database folder.
The database cannot be attached because an error occurred while loading the detach log from the file '\\?\E:\SalesCube_Monthly.0.db\SalesCube_Monthly.detach_log'. One possible reason is that database is already attached in ReadWrite mode to another server instance.


As we did not detach the database, this file detach_log did not get created. Is there any other way, we can attach or recover this database ?

Thoughts on Tabular model for enterprise environments

$
0
0

Hi,

I wanted to ask people of their experience using Tabular (and Multidimensional) models in Enterprise environments.

So, when I say Enterprise, I'm personally referring to using SSAS within an organisation that:

  • Has to be scalable,
  • Is relativley Complex
  • Has slightly large to large datasets 
  • has many disparate systems

I've not used Tabular and from what I've read, it's more difficult to use in these environments due to scalability.  I'd appreciate if you could advise or just share your experiences of advantages/disadvantages with using each model (more specifically Tabular).

Thanks


paul watson

Cube creation - ssas

$
0
0
 

Friends Needs a Help from you .

Requirement is to create a Cube from 2 tables .. I am not able to understand how i should go for dimension creation and fact creation

My tables :

T1

id    label         mapping_value   primaryKey   indexKey

1.0  Red             a0                       1                      1

2.0 Green          a0                        2                      2

3.0 WHite          a0                        3                      3

4.0 Blue             a0                       4                      4

1.0 Peas            a1                       5                      1

2.0  banana      a1                        6                      2

1.0 Sunday       a2                        7                      1

2.0  Monday     a2                         8                      2

3.0  Tues          a2                         9                     3

T2 

id  a0   a1   a2

1    1     1    1

2    1     1    3

3    2     2    3

4    3     2    1

5    1     1    2

6    4     1    1

Table T1 to be considered as a Master Data  and Table T2 as a Mapping table

Mapping Value Combination a0,a1 in Table T1 is till a40 with different values and for the same in table T2 till a40 and having different combinations .

Please help how should i go for Dimension creation as well fact creation.

I need to create a Cube and submit to my Manager.

Please help .

thanks

Rakesh

Multiple Levels in Hierarchy using MDX in SSAS

$
0
0

Hi All,

I am Hiren Parikh from India.

I have a requirement in which I want multiple levels in a single hierarchy.

But this levels should not depend on each other.

For eg - 

+ Country

-India

- China

- Japan

+ State

- X

- Y

- Z

+ City

- Mumbai

- Beijing

- Tokyo etc

I will not select Country, State & City at the same time. If I select the Country then Country will become my filter.

If I select the State then State will become my filter.

If I select the City then City will become my filter. This means all the 3 levels are independent should work.

Thanks in advance...

Regards,

Hiren Parikh


Hiren Parikh

Cube process failed

$
0
0

 I have a scenario like 3 facts table entered collection, disconnect, and writeoff. Those facts in three tables the business is when based on their due date customer pay bill first goes to entered collection table for 30 days even if they did not pay then move to disconnect table for 50 days  if still they do not pay then move to finally writeoff table. so each table contains balance and count info. I am going to create a cube with star schema by joining three tables in view at later establish relationship in dimension. I created view as below and establish relationship with house,location,date,customer in BIDs and process then deployment success but process failed. The attribute key (order key) could not found value  '0' message seen. disco.order key allow null is  configured true is their any way to resolve this issues.

CREATE View [dbo].[vw_PS_Fact_Test]
as
SELECT Entr.[Customer_Key]
      ,Entr.[House_Key]
      ,Entr.[Customer_Extended_key]
      ,Entr.[Location_Key]
      ,Entr.[Entered_Date]
      ,Entr.[Balance] As EnteredCollections_Balance
      ,Disco.Order_Key
      ,Disco.Balance As Disconnect_Balance
      ,Disco.Disconnect_Date
      ,Wri.WriteOff_Amount
      ,wri.WriteOff_Date
      ,1 as Count
  FROM [dwh_trgt_Collections].[dbo].[PS_Fact_Entered_Collections] As Entr WITH (NOLOCK)
  Left join dbo.PS_Fact_Disconnect_Orders As Disco WITH (NOLOCK)
  on Entr.[Customer_Key]= Disco.Customer_Key and
     Entr.[House_Key]= Disco.House_Key and
     Entr.[Customer_Extended_key]= Disco.[Customer_Extended_key]and
     Entr.Location_Key= Disco.Location_Key
   LEFT JOIN dbo.PS_Fact_Write_Off AS Wri WITH (NOLOCK)
   on Entr.[Customer_Key]= Wri.Customer_Key and
     Entr.[House_Key]= Wri.House_Key and
     Entr.[Customer_Extended_key]= Wri.[Customer_Extended_key]and
     Entr.Location_Key= Wri.Location_Key  


Parameters in ssrs MDX report

$
0
0

Getting syntax error while running in the ssrs report, [BC30205) end of statement expected. 

Please help me fixing this code

=" WITH " 
+" MEMBER [FYDay].[DateHierarchy].[CurrentDay]    AS  "
+" AGGREGATE( {  STRTOMEMBER("[FYDay].[DateHierarchy].&["+ Format(Now(), "MM/dd/yyyy")+"]") }, [Measures].CURRENTMEMBER) " 



+" SELECT " 
+" { "

+" [FYDay].[DateHierarchy].[CurrentDay] "

+" } ON COLUMNS, " 
 +" {({ " 
 +" [Measures].[Store Budget], " 
 +" [MEASURES].[SNAPSHOTSOLDAMOUNT], " 
 +" [MEASURES].[SHIPPEDAMOUNT], " 
 +" [MEASURES].[SHIPPED VS SOLD], " 
 +" [Measures].[% To Budget], "
 +" [Measures].[SS%] "
+" }, " 
 +" {[STOREMASTER].[SERVICINGDC].[SERVICINGDC].ALLMEMBERS} " 
 +" )} ON ROWS " 
 +" from ( select {[STOREMASTER].[SERVICINGDC].ALLMEMBERS} on columns " 

 +" FROM [Model] " 
 +" ) "

       Thanks,

Ram

understanding strToMember constrained

$
0
0

Hi all

I have read here

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/c76d2d1c-44ae-4e0c-8cb5-dc0bc9750486/what-is-meaning-of-strtomembercity-constrained?forum=sqlanalysisservices

that:

CONSTRAINED is a keyword which is used to stop injection(hacking), so you need to pass only the member uniquename ([Country].[City].&[123]) and cannot pass member name to it ([Country].[City].[Redmond]).

Why should I worry about injection if cube data is well protected with security ROLES??

TIA!

Rea

SSAS Low disc space

$
0
0


I have installed SSAS in E drive of my server. E drive(50GB size) is dedicated to SSAS. Recently I am getting warning messages from server with 'Low disc space'. Then i observed E disk having only 100MB free space out of 50GB. I checked E drive and i came to know there is one log file(msmdsrv) having the 44GB size. This file type is .Log i opened the same file in notepad format, its having the data of logging information of my cubes.

Can i delete this file to save the disc space?

If i delete this what will happen?

Please suggest me if there is any another option..

Thanks in Advance... 


Sudhan

Export result of ssas query result to excel file

$
0
0

Hi All,

I have browsed a SSAS cube. I want to export result of SSAS cube into excel file.

Kindly give your input.

Thanks,

Vivek singh

Dimension security in SSAS

$
0
0

Hello,

We are trying to report on assets from a DAM platform in SSAS, for which the taxonomy is pretty embedded, reason why in a parent-child relationship I'm having trouble to drill down to the appropriate level since there are like 17 levels. We are trying to restrict access to only 2 members within our Clients classification. I was able to figure it out in VS and to filter in the dimension security (Roles) to restrict access to the particular clients, but it won't drill down to its children and grandchildren. I was wondering if there is any MDX which might be able to surface the children and grandchildren. Since the taxonomy is based on GUIDS is really hard to identify which asset stops at which level. Just to make it more descriptive a record can be part of one or more classifications but it always belongs to a root classification, within a record there are files that can be part of one or more classifications, as well as a file can have several file versions.  I'm trying to see if there is an MDX code which will allow me to uncover the children and grandchildren of the two members in the Clients classification and restrict access only to those two. Also would there be another way in doing this?

I would appreciate any suggestions.

Thanks,

Andrea

Viewing all 14337 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>