Saturday, February 25, 2012

MDX query

I have a dimension and a fact count.

How do i create a query to filter out the dimension using the filter function?

I tried something like :

SELECT {[Measures].[XX Count]} ON COLUMNS,

{ filter([RT].[RT].Members,[RT].[RT].CurrentMember < 10) } ON ROWS

FROM [YYYY]

but invalid.

for eg i have dimension RT with values 1,11,13,50 etc.... so in the row i would expect a row of RT with value 1 and its respective XXCount.

Thanks.

Regards

Alu

This is most likely caused by the fact that you have multiple measures in your cube and when you did not specify a particular measure in the filter clause the default one was used instead of the count measure. The measure on the columns defines the context for the value that is returned in the cells, but not necessarily for the value that is used to evaluate the filter condition. You should change your filter expression to explicitly mention the measure you want to use.

eg.

SELECT {[Measures].[XX Count]} ON COLUMNS,

{ filter([RT].[RT].Members,([RT].[RT].CurrentMember,[Measures].[XX Count] ) < 10) } ON ROWS

FROM [YYYY]

No comments:

Post a Comment