简体   繁体   English

MDX-如何知道某个尺寸是否已绕过尺寸?

[英]MDX - How to know if a measure has been pivoted with a dimension?

I was hoping someone could help me with this problem. 我希望有人可以帮助我解决这个问题。 In a sum type measure, i need to know if this measure has been pivoted with my time dimension. 在总和类型量度中,我需要知道该量度是否已与我的时间维度相关联。 If is not, the measure must show the sum of the last day. 如果不是,则度量必须显示最后一天的总和。 In other case, the measure must show the sum of the day with has been pivoted. 在其他情况下,该度量必须显示已被调整的一天的总和。

I have the measure "Users", if this measure hasn't been pivoted with my time dimensión, it shows the sum of all users of all the time. 我有一个“用户”度量,如果该度量未随我的时间维度调整,它将显示所有时间的所有用户的总和。 For example it shows: 5,000,000. 例如,它显示:5,000,000。 When it has pivoted with the time dimension, it shows de users from the day. 当它随着时间维度旋转时,它将显示当天的用户。 For example: 100,000 for today 21/05/2015. 例如:今天21/05/2015为100,000。

When this measure hasn't been pivoted with the "time" dimension, the measure must show 100,000 and not the total sum of all days. 如果此度量标准尚未以“时间”维度为中心,则该度量标准必须显示100,000,而不是整天的总和。

I've been trying white some MDX formulas but i have not found some solution for this. 我一直在尝试一些MDX公式,但是我还没有找到解决方案。

Thanks 谢谢

I've interpreted this as when pulling your Users measure without pivoting on the Time dimension you would prefer to see the value that corresponds to the current date. 我认为这是在拉动“ Users度量而没有在“ Time维度上旋转时,您希望看到与当前日期相对应的值。

This can be achieved by modifying the Default Member of your Time dimension. 这可以通过修改“ Time维度的“ Default Member ”来实现。 Setting the default date to this last available date 将默认日期设置为该最后可用日期

  • Within your Dimension in SSAS, browse to the Dimension Structure tab and select the attribute which represents the key column (ie. the Usage property is set to Key for only one column) 在SSAS中的“ 维度”中,浏览到“ 维度结构”选项卡,然后选择代表键列的属性(即,“用法”属性设置为仅一列为“键”)
  • Within the Properties pane (strike F4 if you do not see it already to open it) select the Default Member property, then select the elipses (...) 在“ 属性”窗格中(如果尚未打开,请单击F4键),选择“ Default Member属性,然后选择省略号(...)
  • The Set Default Member - [Dimension Name] pane will have 3 options, select the last Enter an MDC expression that specifies the default member 设置默认成员-[维度名称]”窗格将具有3个选项,选择最后一个输入指定默认成员的MDC表达式
  • Use ONE of the following expressions 使用以下表达式之一

     TAIL([Date].[DateAttribute].Members).Item(0) TAIL(NONEMPTY([Date].[DateAttribute].Members)).Item(0) TAIL(EXCEPT([Date].[Date].Members,{[Date].[Date].[Unknown]}),1).Item(0) 

In my case I used the last as I only want to exclude my UnknownMember member 就我而言,我使用了最后一个,因为我只想排除我的UnknownMember成员

Now when you pull the measure down the value will be for the last date in your cube. 现在,当您下拉度量时,该值将是多维数据集中的最后一个日期 This will affect other cubes built on this date dimension of course. 当然,这将影响基于此日期维度构建的其他多维数据集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM