2017-03-05 117 views
0

如何檢查MDX狀態下軸上是否存在一個尺寸?檢查MDX中是否存在尺寸

我需要檢查axis1上有多少時間單位(天,周,月......),並用它來計算度量。下面是例子,我應該怎麼做,我會採取一些尺寸:

days -> [Measures].[A] = [Measures].[B]/number of members in axis 1, from only date dimension (365) 

months -> [Measures].[A] = [Measures].[B]/number of members in axis 1, from only date dimension (12) 

months, product group -> [Measures].[A] = [Measures].[B]/number of members in axis 1, from only date dimension (12) 

所以維度不同於日期維度不應該影響計算。我只需要從[日期]維度中指定成員。

回答

1

一個簡單的例子計算天數:

With 
Member [Measures].[Members on rows] AS 
Axis(1).Count 

Select 
Non Empty [Measures].[Members on rows] on columns, 
Non Empty [Date].[Day].[Day].Members on rows 
From [Sales] 
Where [Date].[Month].[Month].&[201701] 

但是,你得到的只是行數,你無法預知這是怎麼回事用的軸。您還可以檢查整個屬性是否算=報告屬性計數:

Count(existing [Date].[Day].[Day].Members) = Count([Date].[Day].[Day].Members) 

如果返回,最有可能的,這意味着你不使用過濾器[日期]在[日]層次你報告。