Hello all,
I am fairly new to MDX and my current project really gives me a headache. I hope you can help me with that.
We have several stores which are divided into different sales regions. So I built a hierarchy [Sales Region] -> [Store].
Our business wants to see the sales amount of each store compared to the average of the top 3 stores of the same sales region and calculate the difference between theses values. So, basically I have the following starting position:
Sales RegionStoreSales amount
-------------------------------------------------
Reg1Store A
10
Reg1Store B
20
Reg1Store C
30
Reg1Store D
40
Reg2Store E
20
Reg2Store F
30
Reg2Store G
40
Reg2Store H
50
and so on...
First I need to calculate the benchmark which is the average sales amount of the top 3 stores for each region:
Sales RegionBenchmark
-------------------------------------
Reg130 (20 + 30 + 40)/3
Reg240
(30 + 40 + 50)/3
In the next step, I should be able to use the benchmark value in each row and calculate the difference:
Sales RegionStoreSales amountBenchmarkDifference
-----------------------------------------------------------------------------------
Reg1Store A
1030-20
Reg1Store B
2030-10
Reg1Store C
30300
Reg1Store D
4030+10
Reg2Store E
2040-20
Reg2Store F
3040-10
Reg2Store G
40400
Reg2Store H
5040+10
I am already struggling calculating the benchmark value. Can you at least give me a hint where to start?
I really want to understand how to do this, but it seems like I'm more a relational thinking person ;)
Best regards and thanks!