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
AN2021
Frequent Visitor

Substract column with a constant from another column

Hi, I want to calculate as follow:

Minus "Value" for each bucket with "Value" from bucket 1 group by "Division"

DivisionBucketValueDif

A

170 (7 - 7)
A281 (8 - 7)
A392 (9 - 7)
B1100 (10 - 10)
B2133 (12 - 10)
B3155 (15 - 10)

 

I try to use this DAX, but it return to sum up all "Value" from Bucket = 1 from all Division.

 

Total Value = SUM(MY_TABLE[Value])
 
Dif =
CALCULATE(
[Total Value],
FILTER(
ALL(MY_TABLE),
MY_TABLE[Bucket] = 1
)
)
 
DivisionBucketValueDif

A

17-7 (7 - 17)
A28-9 (8 - 17)
A39-8 (9 - 17)
B110-7 (10 - 17)
B213-3 (12 - 17)
B315-2 (15 - 17)
3 ACCEPTED SOLUTIONS

@AN2021 

Try this code please:

Difference = 
Table3[Value]
-
CALCULATE(
    sum(Table3[Value]),
    Table3[Bucket] = 1,
    ALLEXCEPT(Table3,Table3[Division])
) 
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

@AN2021 

 

It still works with new dimensions.

See attached file.

 

If you could share you file so as to have a look at it that would be great

 

 

View solution in original post

Oh my bad, yeap its work, thanks

View solution in original post

8 REPLIES 8
Fowmy
Super User
Super User

@AN2021 

Add the following column:

Dif = Table3[Value] - CALCULATE( MIN(Table3[Value]), ALLEXCEPT(Table3,Table3[Division]))

Fowmy_0-1629365581581.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

AN2021
Frequent Visitor

Hi Fowmy

 

Actually I want to get the "Value" from Bucket = 1, not the Min of "Value". Your solution might work with my example, but in my actual case some "Value" in Bucket = 1 is not the smallest one.

@AN2021 

Try this code please:

Difference = 
Table3[Value]
-
CALCULATE(
    sum(Table3[Value]),
    Table3[Bucket] = 1,
    ALLEXCEPT(Table3,Table3[Division])
) 
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

themistoklis
Community Champion
Community Champion

@AN2021 

 

Try the following measure:

 

 

Measure3 =
VAR __bucket1 =
    CALCULATE (
        SUM ( Sheet1[Value] ),
        FILTER ( ALLEXCEPT ( Sheet1, Sheet1[Division] ), Sheet1[Bucket] = 1 )
    )
RETURN
    SUM ( Sheet1[Value] ) - __bucket1

 

 

Workspace attached on this message

Hi themistoklis

Its work, but wonder why if I have more column, its not works?

From your example I add 1 column named Dim1

AN2021_0-1629371458703.png

 

 

@AN2021 

 

It still works with new dimensions.

See attached file.

 

If you could share you file so as to have a look at it that would be great

 

 

Oh my bad, yeap its work, thanks

@AN2021 

You can click on @themistoklis solution as Accepted, this will help others find it the correct reply.


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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