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! Learn more

Reply
pang22
Helper III
Helper III

create a new measure to calculate the difference

Hello,

 

How to create a new measure to calculate the difference between 2 columns?

Eg. 967,063 - 226,556

Thanks.

 

 

pang22_0-1698375286673.png

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @pang22 

 

Sample data:

vzhangti_0-1698833065366.png

Measure = 
Var _N1=CALCULATE(SUM('Table'[Qty]),FILTER(ALLEXCEPT('Table','Table'[Month]),[Type]="OPN"))
Var _N2=CALCULATE(SUM('Table'[Qty]),FILTER(ALLEXCEPT('Table','Table'[Month]),[Type]="Order OH"))
Return
IF(HASONEVALUE('Table'[Type]),SUM('Table'[Qty]),_N1-_N2)

vzhangti_1-1698833188197.pngvzhangti_2-1698833205547.png

Is this the result you expect? Please see the attached document.

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @pang22 

 

Sample data:

vzhangti_0-1698833065366.png

Measure = 
Var _N1=CALCULATE(SUM('Table'[Qty]),FILTER(ALLEXCEPT('Table','Table'[Month]),[Type]="OPN"))
Var _N2=CALCULATE(SUM('Table'[Qty]),FILTER(ALLEXCEPT('Table','Table'[Month]),[Type]="Order OH"))
Return
IF(HASONEVALUE('Table'[Type]),SUM('Table'[Qty]),_N1-_N2)

vzhangti_1-1698833188197.pngvzhangti_2-1698833205547.png

Is this the result you expect? Please see the attached document.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

measures need aggregations.  So instead of saying

 

measure = [Column1]-[Column2]

 

you need to say

 

measure = sum(Table[Column1])-sum(Table[Column2])

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