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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
TheITAnalyst13
Frequent Visitor

DAX Formula for subtracting columns?

Hi All,

 

I'm trying to subtract the value of 2 columns in such a way as below:

 

Column AColumn BColumn CColumn D
A08SUM(B2:B3)-SUM(C2:C3)
A30
C010SUM(B4:B5)-SUM(C4:C5)
C50

 

Can someone please help to give me a formula for Column D? I tried the formula below but it is not working:

 

Column D = CALCULATE(SUM(Column B)-SUM(Column C))

 

Appreciate help on this!

1 ACCEPTED SOLUTION

Hi @TheITAnalyst13,

 

That case, you could new a calculated table with below DAX formula:

Tb2 =
SUMMARIZE (
    Tb1,
    Tb1[Column A],
    "ColumnB", SUM ( Tb1[Column B] ),
    "ColumnC", SUM ( Tb1[Column C] ),
    "ColumnD", SUM ( Tb1[Column B] ) - SUM ( Tb1[Column C] )
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @TheITAnalyst13,

 

Column D =
CALCULATE ( SUM ( Tb1[Column B] ), ALLEXCEPT ( Tb1, Tb1[Column A] ) )
    - CALCULATE ( SUM ( Tb1[Column C] ), ALLEXCEPT ( Tb1, Tb1[Column A] ) )

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the suggestion Yuliana!

 

Is there a way I can sum the same item together so it will only appear in one row.

 

From this:

 

Column AColumn BColumn CColumn D
A08SUM(B2:B3)-SUM(C2:C3)
A30
C010SUM(B4:B5)-SUM(C4:C5)
C50

 

To this:

 

Column AColumn BColumn CColumn D
A0+38+0B9-C9
C0+510+0B10-C10

Hi @TheITAnalyst13,

 

That case, you could new a calculated table with below DAX formula:

Tb2 =
SUMMARIZE (
    Tb1,
    Tb1[Column A],
    "ColumnB", SUM ( Tb1[Column B] ),
    "ColumnC", SUM ( Tb1[Column C] ),
    "ColumnD", SUM ( Tb1[Column B] ) - SUM ( Tb1[Column C] )
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors