MDX向本月展示和订购的客户展示,但不是去年的这个月

时间:2016-02-25 18:48:50

标签: mdx olap

我正在努力解决mdx看起来想要退回本月订购但未在去年同一月下订单(0美元销售额)的客户。

我将Order Amount作为度量,CustomerId作为维度,Date作为维度。

1 个答案:

答案 0 :(得分:1)

您需要添加一些您已经尝试过的代码。

mdx伪代码中,它将是这样的:

  Except(  
    NonEmpty(
       {all members}                      //<<try a function that returns a set such as `.MEMBERS`
       ,(thisMonth, OrderAmountMeasure)   //<<the braces mean this is a tuple made up of two members
    )
   ,NonEmpty(
       {all members}                
       ,(equivMonthLastYear, OrderAmountMeasure)   //<<you could try the .LAG function to go back 12 months
    )
   )

编辑:

  iif(
     equivMonthLastYear = 0,
     null,
  Except(  
    NonEmpty(
       {all members}                      //<<try a function that returns a set such as `.MEMBERS`
       ,(thisMonth, OrderAmountMeasure)   //<<the braces mean this is a tuple made up of two members
    )
   ,NonEmpty(
       {all members}                
       ,(equivMonthLastYear, OrderAmountMeasure)   //<<you could try the .LAG function to go back 12 months
    )
   )
 )
相关问题