Forum Discussion
Roll up Abs difference at group level
- 6 years ago
Hello Fuhrer786
Give this a try. It will generate a virtual table of all the [Product Group] in your DimProduct table then, for each row in the virtual table it will do the ABS calc and finally it will add up all those values.
Measure = SUMX ( VALUES ( DimProduct[Product Group] ), ABS ( CALCULATE ( SUM ( SalesTable[Totalsales] ) ) - CALCULATE ( SUM ( FinalPredictions[Predictedsales] ) ) ) ) - 6 years ago
Hello Fuhrer786
No, you are not doing anything wrong. I forgot to force the context transition in the iterator. It should have been.
Measure = SUMX ( VALUES ( DimProduct[Product Group] ), ABS ( CALCULATE ( SUM ( SalesTable[Totalsales] ) ) - CALCULATE ( SUM ( FinalPredictions[Predictedsales] ) ) ) )But two measures is the way to do it because they force the context transition and can be used in other places.
Hello Fuhrer786
Give this a try. It will generate a virtual table of all the [Product Group] in your DimProduct table then, for each row in the virtual table it will do the ABS calc and finally it will add up all those values.
Measure =
SUMX (
VALUES ( DimProduct[Product Group] ),
ABS ( CALCULATE ( SUM ( SalesTable[Totalsales] ) ) - CALCULATE ( SUM ( FinalPredictions[Predictedsales] ) ) )
)Hello jdbuchanan71
It worked perfect now. I created 2 separate measures for actualsales and forecast value
TotalSales=sum(Salestable[TotalSales])
TotalForecast=sum(Finalpredictions[PredictedSales])
Measure =
SUMX (
VALUES ( DimProduct[Item Number] ),
ABS (TotalSales - TotalForecast )
)Formula still same, I must be doing something wrong but creating extra measures worked for me! Thank u so much
- jdbuchanan716 years agoSuper User
Hello Fuhrer786
No, you are not doing anything wrong. I forgot to force the context transition in the iterator. It should have been.
Measure = SUMX ( VALUES ( DimProduct[Product Group] ), ABS ( CALCULATE ( SUM ( SalesTable[Totalsales] ) ) - CALCULATE ( SUM ( FinalPredictions[Predictedsales] ) ) ) )But two measures is the way to do it because they force the context transition and can be used in other places.