简体   繁体   English

计算角色扮演维度的度量?

[英]Calculated measure on role playing dimension?

I have a ssrs report based on a ssas cube. 我有一个基于ssas多维数据集的ssrs报告。 In the report I want to group the companys results by organizational structure. 在报告中,我想按组织结构对公司的结果进行分组。 The structure can change from year to year and the history is kept in a SCD 2 dimension. 该结构可以每年更改,并且历史记录保存在SCD 2维中。 The organizational structure is grouped in 4 levels (Division, Work Area, Base unit, Responsible Unit). 组织结构分为四个级别(部门,工作区域,基本单位,负责单位)。 All results are registered on the lowest level. 所有结果均以最低级别注册。 A usuall action is that a Resonsible unit is moved between Divisions. 通常的做法是在各部门之间移动“负责任”部队。

In the report I want to have 2 columns, the results for choosen year in the first column and the result for previous year in the second column. 在报告中,我希望有2列,第一列中为所选年份的结果,第二列中为上一年的结果。 The user can choose wich year he/she wants to run the report for. 用户可以选择他/她想要运行报告的年份。 In the cube I have created two Calculated measures, Result_current_year and Result_previous_year. 在多维数据集中,我创建了两个计算度量,即Result_current_year和Result_previous_year。 My fact rows are connected to the dimension with a warehouseID (AE_WID_HISTORY). 我的事实行通过WarehouseID(AE_WID_HISTORY)连接到维度。

Now to my problem. 现在到我的问题。 The measures are bound to the organizational structure that was present in that year. 这些措施与当年存在的组织结构有关。 This is not what my customer wants. 这不是我的客户想要的。 They want to compare the result from both years according to the organizational structure of the current year. 他们想根据当年的组织结构比较这两年的结果。

My idea of solution is to create a new column in the fact table that holds the foreign key to the row of the dimension representing next years organizational structure. 我解决方案的想法是在事实表中创建一个新列,其中包含表示下一年度组织结构的维度行的外键。 The problem is that this value doesnt exist when the row is created. 问题是在创建行时该值不存在。 To accomplish this I have to loop over the fact table the year after and update all rows with the correct value. 为此,我必须在第二年循环遍历事实表,并使用正确的值更新所有行。 In the cube I would then create a roleplaying dimension that represents next years organizational structure. 然后,在多维数据集中,我将创建一个代表下一年组织结构的角色扮演维度。 In my calculated measure "Result_previous_year" I would then use this roleplaying dimension. 然后,在计算得出的度量“ Result_previous_year”中,我将使用此角色扮演维度。

Is this possible and if YES, how would the MDX for the calculated measure "Result_previous_year" look? 这是否可能,如果是,则计算得出的度量“ Result_previous_year”的MDX看起来如何?

I honestly think that your problem definition is your answer. 老实说,我认为您的问题定义就是答案。

They want to compare the result from both years according to the organizational structure of the current year 他们想根据当年的组织结构比较这两年的结果

This means that there is no point in going through all the hassle implementing a SCD. 这意味着完成SCD的所有麻烦都是没有意义的。

All you need is the current snapshot of the dimension structure and to make sure all facts have the real ID of Responsible unit (not the one generated by the warehouse). 您只需要维结构的当前快照,并确保所有事实都具有负责单位的真实ID(而不是仓库生成的ID)。 That way, no matter where the RU ends up next year, all the sales history will automatically move with it into the next years organisational structure. 这样,无论RU明年在哪里结束,所有销售历史记录都将自动随之转移到下一年的组织结构中。

As for the MDX for previous year, it depends on details of how things are structured in your case, but basically hooking on to [DimDate].[Year].CURRENTMEMBER and .LAGing that should be all that is necessary to find the 'previous year' member. 至于上一年的MDX,它取决于您的情况下结构的详细信息,但基本上取决于[DimDate]。[Year] .CURRENTMEMBER和.LAGing,这些对于查找“上一个”年会员。 Consider as well creating relative time hierarchies which would contain Current Year, Previous Year, Current Month etc. This makes report development sooooo much more convenient! 还考虑创建相对时间层次结构,其中将包含当前年份,上一年,当前月份等。这使报表开发变得非常方便! When you write your query MDX you can reuse these relative items independent of the measure. 编写查询MDX时,可以独立于度量重新使用这些相关项。 That way you will avoid creating year-based measures as well. 这样,您也将避免创建基于年份的度量。

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

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