计算组成员中False值的成员

时间:2017-09-18 20:56:50

标签: reporting-services mdx

我希望能够计算出#Is; IsDefault"每个FundTyoeCode列的帖子IsDefault是" False"

SELECT { [Measures].[Total Funds]} ON COLUMNS, 
Non Empty CrossJoin ({
[ExpenditureLineItem].[ProgLookup].[ProgLookup].&[C81C0001]},
{
[Fund].[FundTypeCode].[FundTypeCode].allmembers*
[Fund].[Description].[Description].Allmembers*
[Fund].[IsDefault].[IsDefault].Allmembers
}
)On Rows
FROM   [Model]

以下是查询结果

Program Fund CODE   Fund Name                  Is Default   Total Funds
C81C0001    1       General Funds              TRUE         $26,564,116.00 
C81C0001    3       Cigarette Restitution Fund FALSE        $600,000.00 
C81C0001    3       Special Funds              TRUE         $5,822,569.00 
C81C0001    9       Reimbursable Funds         TRUE         $8,889,780.00 

因此,根据此示例,计算出的成员列应该为基金代码3提供1的计数

我一直在玩计算会员

WITH MEMBER [CountFalse] as count( { [Fund].[IsDefault].[IsDefault].[False]*[Fund].[FundTypeCode].[FundTypeCode]}) 但它显示不正确的结果。(所有FundTypeCodes,而不仅仅是我查询切片的那些)

1 个答案:

答案 0 :(得分:0)

尝试:

WITH 
MEMBER [CountFalse] as 
SUM(
    existing [Fund].[FundTypeCode].[FundTypeCode].Members,
    IIF(
        ([Fund].[IsDefault].[False],[Measures].[Total Funds]) > 0,
        1,
        NULL
    )
)