Forum Discussion
homboy27
Helper III
7 years agoDifference column in a matrix
Client Hours Revenue X 123 20000 Y 100 10000 23 10000 I created the above table in PowerBI. How do i create the 3rd column that subtracts client x from y?
- 7 years ago
homboy27 the solution I proposed should work, doesn't matter number of records. Pbix is attached for your reference.
Ashish_Mathur
Super User
7 years agoHi,
Assuming Hours and Revenue are measures, try this measure
=[Revenue]-CALCULATE([Revenue],Data[Client]="Client X")
Hope this helps.
homboy27
Helper III
7 years agoThat didnt work. Also hours and revenues are not measures.
- Ashish_Mathur7 years ago
Super User
Hi,
Share the link from where i can download your PBI file. Also show the expected result.
- homboy277 years ago
Helper III
Client Hours Revenue X 123 20000 Y 100 10000 Expected Result 23 10000 please see above. i created a table with the first 3 rows. Expected result column is what i would like to create. It basically subtracts the value from columns 2 and 3.
- parry2k7 years ago
Super User
homboy27 add two new measures as belowo, drop table visual with Client, Total Hours, Total Revenue and you will have your solution
Total Revenue = IF( ISINSCOPE( Table3[Client] ), SUM( Table3[Revenue] ) , CALCULATE( SUM( Table3[Revenue] ), Table3[Client] = "X" ) - CALCULATE( SUM( Table3[Revenue] ), Table3[Client] = "Y" ) ) Total Hours = IF( ISINSCOPE( Table3[Client] ), SUM( Table3[Hours] ) , CALCULATE( SUM( Table3[Hours] ), Table3[Client] = "X" ) - CALCULATE( SUM( Table3[Hours] ), Table3[Client] = "Y" ) )- homboy277 years ago
Helper III
That did not work either