Forum Discussion
subtract value from different rows
- 8 years ago
Hi Anonymous,
Per my understand about Measure and Grand Total in Power BI. The Measure is based on Row Content, so it can use the conditions in SWITCH() function. However the Grand Total is based on entire Table Content, it cannot check each conditions in SWITCH(). It also means that the Grand Total is just sum on CALCULATE(SUM('TFINANG'[Amount])) not the values of measure.
To get the right Grand Total, you can create a new table with Measure values as its row content. Like:
New Table Adj Amount = SUMMARIZE ( TFINANG, TFINANG[Group], TFINANG[TimeLine], "Adj", IF ( TFINANG[Group] = "L10000", SUM ( TFINANG[Amount] ) - CALCULATE ( SUM ( TFINANG[Amount] ), TFINANG[Group] = "L20000" ), SUM ( TFINANG[Amount] ) ) )Thanks,
Xi Jin.
i just did thanks, and it nearly got me there. the row amounts are perfect, but the total is messing up now. take a look.
the total should be £178,612
thanks
Hi Anonymous,
Per my understand about Measure and Grand Total in Power BI. The Measure is based on Row Content, so it can use the conditions in SWITCH() function. However the Grand Total is based on entire Table Content, it cannot check each conditions in SWITCH(). It also means that the Grand Total is just sum on CALCULATE(SUM('TFINANG'[Amount])) not the values of measure.
To get the right Grand Total, you can create a new table with Measure values as its row content. Like:
New Table Adj Amount =
SUMMARIZE (
TFINANG,
TFINANG[Group],
TFINANG[TimeLine],
"Adj", IF (
TFINANG[Group] = "L10000",
SUM ( TFINANG[Amount] )
- CALCULATE ( SUM ( TFINANG[Amount] ), TFINANG[Group] = "L20000" ),
SUM ( TFINANG[Amount] )
)
)
Thanks,
Xi Jin.
- Anonymous8 years agoNot applicable
thanks
worked a treat
- Anonymous8 years agoNot applicable
thanks
worked a treat
- Anonymous8 years agoNot applicable
hi Xi,
i wanted to add another column to the new table. The column is just a description for the Group, however, i have lost the accurate Adj figures. is there something else i need to do, ta