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
MP-iCONN
Resolver I
Resolver I

Subtraction of two columns not showing the correct values

I have an issue with two columns I am trying to subtract from.

 

One column is called Required Qty and the other is called Original Blanket Qty.  


I created a measure called Unscheduled Blanket Qty:

Unscheduled Blanket Qty = CALCULATE(SUM('Sales Orders'[Original Blanket Qty])) - SUM('Sales Orders'[Required Qty])
 
As you can see from the screenshot the 2nd line does NOT appear to be subtracting correct.  I tried a bunch of different options but not sure how to get the math to be correct.
 
Any help is greatly appreciated!
 
MPiCONN_0-1631291103142.png

 

Thank you.

 

Chad

 
1 ACCEPTED SOLUTION

@MP-iCONN 

pls try this

measure = max('Table'[orignial blanket qty])-max('Table'[rquired qty])

Measure 2 = sumx('Table',[measure])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
v-yetao1-msft
Community Support
Community Support

Hi @MP-iCONN 

Your formula works well on my side, you can refer to my pbix file. If possible, please provide your pbix file so that we can find the cause of the problem .

Ailsamsft_0-1631516342001.png

Best Regards

Community Support Team _ Ailsa Tao

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

ryan_mayu
Super User
Super User

@MP-iCONN 

maybe you can try

SUM('Sales Orders'[Original Blanket Qty]) - SUM('Sales Orders'[Required Qty])

you can use measures to display the first two columns to check if returns the correct result and do the calculation between these two measures.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Same issue.

 

I did a SUM measure for both Blanket Qty and Required Qty and then added in my Unchscheduled Blanket Qty with the SUM('Sales Orders'[Original Blanket Qty]) - SUM('Sales Orders'[Required Qty]) measure and still the same value where it is not subtracting the 1820 from 910 correctly.

 

MPiCONN_0-1631294648473.png

 

@MP-iCONN 

pls try this

measure = max('Table'[orignial blanket qty])-max('Table'[rquired qty])

Measure 2 = sumx('Table',[measure])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I tried this and the MAX seemed to work for measure1 (Unscheduled Blanket Qty) but then I did the SUMX of that Measure1 and still off.

 

Unscheduled Blanket Qty = MAX('Sales Orders'[Original Blanket Qty]) - MAX('Sales Orders'[Required Qty])
 
Unscheduled Blanket Total = SUMX('Sales Orders',[Unscheduled Blanket Qty])

 

MPiCONN_0-1631552549309.png

 

Thank you for your help so far! 

@MP-iCONN 

since i can't reproduct the issue, could you pls provide some sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.