Forum Discussion
power bi difference between two columns in a matrix
- Anonymous4 years ago
Hi dopingcontrol ,
Arul use PIVOT function in Power Query to achieve your goal. This way will transform your data model. If you don't want to transform your table, you can try to create a measure to show difference in Total and rename "Total" by "Diff".
Measure = VAR _REVENUE = SUM('Table'[REVENUE]) VAR _ACTUAL = CALCULATE( SUM('Table'[REVENUE]),'Table'[LEVEL] = "Actual") VAR _Budget = CALCULATE( SUM('Table'[REVENUE]),'Table'[LEVEL] = "Budget") RETURN IF(HASONEVALUE('Table'[LEVEL]),_REVENUE,_ACTUAL - _Budget)Then create a matrix visual.
Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi dopingcontrol ,
Arul use PIVOT function in Power Query to achieve your goal. This way will transform your data model. If you don't want to transform your table, you can try to create a measure to show difference in Total and rename "Total" by "Diff".
Measure =
VAR _REVENUE = SUM('Table'[REVENUE])
VAR _ACTUAL = CALCULATE( SUM('Table'[REVENUE]),'Table'[LEVEL] = "Actual")
VAR _Budget = CALCULATE( SUM('Table'[REVENUE]),'Table'[LEVEL] = "Budget")
RETURN
IF(HASONEVALUE('Table'[LEVEL]),_REVENUE,_ACTUAL - _Budget)
Then create a matrix visual.
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.