Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

MDX Question

$
0
0

Hi there,

I have a calculated member that multiplies a measure by a weight, which is a property of members in given dimension.

CREATE MEMBER CURRENTCUBE.[Measures].[Promotion Weighted Count]
 AS [Measures].[Promotion Count] * [Location].[Location].Properties( "Location Weight" )), 
VISIBLE = 1  ;  

FYI. [Promotion Count] is a distinct count measure.

This works fine, though it does not work correctly for ALL member of LOCATION dimension. The "location weight" is a property of each member, and naturally does not makes sense at ALL level. So at ALL level, I would like the formula to SUM up calculation for its members. Like below:

CREATE MEMBER CURRENTCUBE.[Measures].[Promotion Weighted Count] AS IIF( [M[Location].[Location].currentmember is [Location].[Location].[All], SUM( [MD [Location].[Location].children, [Measures].[Promotion Weighted Count]), [Measures].[Promotion Count] * [Measu[Location].[Location].Properties( "Location Weight" ),
VISIBLE = 1  ; 

This also works fine. But, when I use filters on LOCATION dimension on my report, it still calculates

above considering ALL CHILDREN, ignoring filters.

How can I modify the part: "... [MD [Location].[Location].children, .." to make sure this set contains

currently selected set of locations?..

THank you in advance,

Robert


Viewing all articles
Browse latest Browse all 2472

Trending Articles



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