MDX and PeriodsToDate

 ̄綄美尐妖づ 提交于 2019-12-12 01:29:54

问题


I'm very new to MDX so I hope this is a simple question for a MDX expert. I have the following expression SUM(PeriodsToDate([Accounting Date].[(All)]),[Measures].[Amount]) which this piece works as expected. I need to add a filter or IIF statement that basically does the following:

IF 
  SUM(PeriodsToDate([Accounting Date].[(All)]),[Measures].[Amount]) < 0 
    Then 0
Else 
  SUM(PeriodsToDate([Accounting Date].[(All)]),[Measures].[Amount])

回答1:


I'm afraid it's impossible to do with pre-aggregated data. The MDX IIF function works per a member, the SQL IIF works per a row. You have to add a measure like Amount, but with iif([Amount] < 0,0,[Amount]). Also you may try the code below, nonetheless, I doubt it results properly:

SUM(
    NULL:[Accounting Date].[Calendar].CurrentMember,
    IIF(
        [Measures].[Amount] < 0,
        NULL,
        [Measures].[Amount] 
    )
)


来源:https://stackoverflow.com/questions/42167709/mdx-and-periodstodate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!