cancel
Showing results for 
Search instead for 
Did you mean: 
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
Super User
Super User

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors
Top Kudoed Authors