MDX as Calculated Member in SSAS Cube

55 Views Asked by At

I have a FactBudget per sales region with fields [Budget SalesRegion] and [Sales Region]. In the dimension DimCustomer I have the fields [Sales Region] and [Customer Type].

The relation between FactBudget and DimCustomer is defined only on the [Sales Region].

I have a rather simple mdx statement that filters the [Sales Region] of the DimCustomer for a certain [Customer Type]. With the returned [Sales Region] I select the correspondent [Budget SalesRegion]:

SELECT 
   (
   FILTER(
      [Kunde].[Sales Region].members
     ,[Kunde].[Customer Type].CURRENTMEMBER
          =[Kunde].[Customer Type].[All].[Direct Sales]
    )
   ,[Measures].[Budget SalesRegion]
   ) ON 0,
   [Kunde].[Customer Type].[All].[Direct Sales] ON 1
FROM [BI_DWH];

How can I translate this statement into an Calculated Member in the SSAS cube so that the selected [Customer Type] in a slicer filters the statement accordingly?

1

There are 1 best solutions below

1
whytheq On

This:

SELECT 
   (
   FILTER(
      [Kunde].[Sales Region].members
     ,[Kunde].[Customer Type].CURRENTMEMBER
          =[Kunde].[Customer Type].[All].[Direct Sales]
    )
   ,[Measures].[Budget SalesRegion]
   ) ON 0,
   [Kunde].[Customer Type].[All].[Direct Sales] ON 1
FROM [BI_DWH];

Is the same as this:

SELECT 
   [Measures].[Budget SalesRegion] ON 0,
   [Kunde].[Customer Type].[All].[Direct Sales] ON 1
FROM [BI_DWH];

Or if you want to use the slicer axis:

SELECT 
   [Measures].[Budget SalesRegion] ON 0
FROM [BI_DWH]
WHERE [Kunde].[Customer Type].[All].[Direct Sales];

Now it is simplified I do not understand what you question is?