0
votes

I have a ssrs report based on a ssas cube. 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. 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. 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. My fact rows are connected to the dimension with a 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.

Is this possible and if YES, how would the MDX for the calculated measure "Result_previous_year" look?

1

1 Answers

0
votes

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.

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). 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.

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. 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. That way you will avoid creating year-based measures as well.