cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
noobpowerbiuser
Frequent Visitor

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

@noobpowerbiuser , 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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors