简体   繁体   中英

MDX Calculation . Filetring a measure based on the value in another column

I see the problems I have are of nature 'filter one fact table measure based on the value of a column in the same fact table'.

I have a cube with measure called Report. 'Calls' and 'Failure' are columns of this measure. There is a dimension called 'trial'. I have to write few new calculations in SSAS Cube.

  1. Sum([measure].[calls] ) only if failure = 1 and value of [Trial categories].[Trail].&[1].

 I din't get the desired result using filter. So I created a new column in the fact table 'calls_if_failure' = 'calls' or 0 depending on the value of failure column.  And then in the calculated column I used sum([calls_if_failure], [Trial categories].[Trail].&[1]) . Is this the only way to do this?

  1. Now I have many more requirements of the nature -> Sum([measure].[calls] ) only if [measure].[visit] = 1 Should I take the same approach as before to arrive at the solution? If yes, then this would mean many more columns in fact table.

Appreciate any help. Thank You.

Struggling to understand the question a little but maybe the following will at least help to give you some ideas:

SUM ( 
  IIF (
     [Trial categories].CURRENTMEMBER IS [Trial categories].[Trail].&[1]
 , [measure].[calls]
 , NULL
)
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM