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

How to Add and Subtract in the same measure

Hey,

So my goal here is I need to Add and Subtract in the same measure.

I have a Total Price that I need to add with a Line Amount - Credit Amount:  TotalPrice - (Line Amount + Credit Amount) = what i need

So my theory was...

SUM('Job_Planning_Lines'[Total_Price]) - SUM(('Posted_Sales_Invoice_ExcelSalesInvLines'[Line_Amount]) + SUM(Detailed_Customer_Ledger_Entries_Excel[Credit_Amount]))
This would not work for me, any clues on this?  Let me know if more info is needed on this 
Thanks!
Thomas
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

The parentheses need to be outside of your second SUM.

 

SUM('Job_Planning_Lines'[Total_Price]) - (SUM('Posted_Sales_Invoice_ExcelSalesInvLines'[Line_Amount]) + SUM(Detailed_Customer_Ledger_Entries_Excel[Credit_Amount]))

View solution in original post

4 REPLIES 4
thomas_coltrain
Frequent Visitor

Thanks everyone was able to get it to work!

jppv20
Solution Sage
Solution Sage

Hi @thomas_coltrain ,

 

This looks a wrong placement of the brackets, you could try this:

SUM('Job_Planning_Lines'[Total_Price]) - (SUM('Posted_Sales_Invoice_ExcelSalesInvLines'[Line_Amount]) + SUM(Detailed_Customer_Ledger_Entries_Excel[Credit_Amount]))

 

If this does not solve the problem could you please provide some example data from your tables?

 

Jori

 

If I answered your question, please mark it as a solution to help other members find it more quickly.

 

 

PaulDBrown
Community Champion
Community Champion

How is your model set up? What kind of visual do you want to put the measure in?

Can you supply a sample PBIX file (without confifential information) or sample data from all tables in tabular form (not images)





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






AlexisOlson
Super User
Super User

The parentheses need to be outside of your second SUM.

 

SUM('Job_Planning_Lines'[Total_Price]) - (SUM('Posted_Sales_Invoice_ExcelSalesInvLines'[Line_Amount]) + SUM(Detailed_Customer_Ledger_Entries_Excel[Credit_Amount]))

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.