开发者

Calculated measures in MDX not working

I wanted to have results something like this:

city zip revenue x

A | 1 | 2000 | 10000

A | 2 | 3000 | 10000

A | 3 | 5000 | 10000

B | 6 | 1500 | 3000

B | 9 | 1500 | 3000

To get the results, I wrote this mdx statement, but revenue and X are coming out same. I thought the revenue 开发者_JS百科would be aggregated over city only and for each zip the value would be the same because the city associated with the zip is same. I wonder if any body can help me out here.

with member [Measures].[X] as '([Location].[City].currentmember, [Measures].[Revenue])'

SELECT NON EMPTY { Measures.[Revenue], [Measures].[X]} ON COLUMNS, NON EMPTY { ([Location].[City].[City]*[Location].[zip].[zip] ) } ON ROWS FROM [State Revenue]))

Regards


You have to specify explicitly that you need the aggregated total for the zip code. Try adding the DefaultMember of the [zip] hierarchy in the tuple, as follows:

with member [Measures].[X] as '([Location].[City].currentmember, [Location].[Zip].DefaultMember, [Measures].[Revenue])'

SELECT NON EMPTY { Measures.[Revenue], [Measures].[X]} ON COLUMNS, NON EMPTY { ([Location].[City].[City]*[Location].[zip].[zip] ) } ON ROWS FROM [State Revenue]))

The DefaultMember function represents the (All) member unless specified otherwise.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜