简体   繁体   中英

Create Calculated Measure based on dimension filter condtion

I am trying to create a new calculated measure in my cube based on a dimension attribute value. Fact and Dimension table looks like below.

在此处输入图片说明

So, far below MDX script is generated from the form view.

 SELECT NON EMPTY { [Measures].[FactCount] } ON COLUMNS
,NON EMPTY { ([DimDate].[Year].[Year].ALLMEMBERS * [DimDate].[Month Name].[Month Name].ALLMEMBERS 
*
({FILTER(
[DimFilter].[Desc].[Desc], 
[DimFilter].[Desc].CurrentMember.Name = 'F1')
})


) } ON ROWS 
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS 
FROM [FactTest]
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

However above script only returns for the dim filter value 'F1' How can I get the other measure columns(output table from image) from the cube.

Any kind of help suggestion is appreciated and thanks in advance for your help!

You meant the following query?

SELECT NON EMPTY { [Measures].[FactCount] } ON COLUMNS
    ,NON EMPTY { ([DimDate].[Year].[Year].ALLMEMBERS * [DimDate].[Month Name].[Month Name].ALLMEMBERS 
    *
    {[DimFilter].[Desc].[F1],[DimFilter].[Desc].[F2]}        

    ) } ON ROWS 
    DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS 
    FROM [FactTest]
    CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

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