Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

custom rollup before aggregation

$
0
0

I create a test1 cube

DimA1
  keyA1
   1
   2
   3

DimA2
 keyA2 parentKeyA2 operator customrollup
 1         NULL        NULL max([Dim A2].[Parent Key A2].currentmember.children, measures.Amount)
 2         1            +   NULL
 3         1            +   NULL

FactA3
keyA1    keyA2 amount
1         2     202
2         2     151
1         3     110
2         3     210

DimA2 is a parent-child

Query
select measures.amount on 0,
{([Dim A2].[Parent Key A2].&[1]
,[Dim A1].[Key A1].[Key A1])}on 1
from [test1]

gives the result--
  Amount
1 1 202
1 2 210
1 Unknown (null)

KeyA2=1 is calculated from the max of its children(2,3). 202 is the max(202,110), 210 is max(151,210)

But the Query
select measures.amount on 0,
{([Dim A2].[Parent Key A2].&[1]
)}
 on 1
from [test1]
gives the result
353 which is calculated as max( sum(202+151), sum(110+210)). The aggregation on DimA1 occurs before doing the custom rollup.
I want to do the custom rollup on DimA2 first before aggregating on any other dimensions. The value I am looking for is sum(202,210) =412

How do I do it?


Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>