Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Subtract Column subtotals to each row value DAX

Hi All,


As the title suggest, I have this set of data with a simple total matrix

 JanFebMarchAprilMayJuneJulyTotal
A10120105
B20010104
C12010105

 

Is it possible to get the value of ONLY the column subtotals (5,4,5) and subtract them into each row value? I know I can define the total of the whole table with a Calculate(sum(cost),ALL(table)) Code. But I only want to get the subtotal value for each row. 
The desired output is the one below:

 JanFebMarchAprilMayJuneJulyTotal
A(5-1)4(5-0)5(5-1)4(5-2)3(5-0)5(5-1)4(5-0)55
B24434344
C43545455

Thanks!

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Assume you alreay using a measure M1, try one of the two

 

Diff = calculate([M1], removefilters(Table[Month]))

 

Diff =  calculate([M1], Filter(allselected(Table), Table[column] = max(Table[column])) )

 

Column is the column having A,b,C

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.