[英]Have to make Calculated Measure NULL for the starting year of a dimension in SSAS Cube
I have a cube that maintains 4 years of data(Say 2014 to 2017(till now)). 我有一个可维护4年数据的多维数据集(说2014年至2017年(至今))。 I have two calculate measure in which i have to make NULL for year 2014. Till now we are using SCOPE and making it NULL.
我有两个计算指标,其中我必须在2014年将NULL设为零。直到现在,我们正在使用SCOPE并将其设为NULL。
For example, below is the existing code for a calculated Measure to become NULL for year 2014. 例如,以下是计算出的度量在2014年变为NULL的现有代码。
SCOPE (DESCENDANTS([Calendar_Date].[Calendar_Date].[2014]));
[Measures].[Policy Retention Rate] = NULL;
END SCOPE;
Calendar_Date is a dimension and having only one Hierarchy "Calendar_Date". Calendar_Date是一个维度,并且只有一个层次结构“ Calendar_Date”。
Every year we have to change the value which is passed in scope. 每年我们都必须更改范围内传递的值。 We have to change it to 2015 next year which is causing manual work.
我们必须将其更改为明年的2015年,这将导致手动工作。 So i have to automate it.
所以我必须自动化。 Kindly help me with this.
请帮助我。
You can generate year dynamically. 您可以动态生成年份。 For example, get a member 3 years ago:
例如,3年前获得一个会员:
StrToMember('[Calendar_Date].[Calendar_Date].&[' + Format(Now(),'yyyy') + ']').Lag(3)
However I'm not sure if it's possible to use that within SCOPE statement. 但是我不确定在SCOPE语句中是否可以使用它。
PS: I'd remove the deprecated partitions on your DWH instead of MDXing your data. PS:我将删除DWH上已弃用的分区,而不是MDXing数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.