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
nancymccool
New Member

How to add and asubtractcolumns from different tables

I am creating a column to show how much is left to complete; I am taking to coulms from 1 table and 1 cloumn from another table, but it is not Adding/Subtracting corretly.  It is giving a weird number for every lineScreenshot 2023-05-26 100917.png

 Left to Complete = SUM('FCOs'[Contract Amount])+SUM('FCOs'[Change Order Amount])-SUM('Bill Details'[LineAmount])

4 REPLIES 4
nancymccool
New Member

@v-yanjiang-msft

 

I dont know what I am doing wong, using your formula and still get the wrong totals.

Its providing the wrong totals;

Ex. Millers Contract is $554,555.00, and I add the change orders $183,981.00 and subtract their invoices $175,022.29, and Left to Complete DOES not equal $565,513.71, it shows as $7,859,734.71.  And yes, the FCOs and Bill Details are attached by relationsip. see below adding and subtracting issue.pngsee attached

Hi @nancymccool ,

According to your snapshot, I find some values are correct (like American Concrete&Precast), but some are wrong, I think it relates to the data model. If you only want to show the result in visual, you can choose a measure instead of column, please try it.

Measure=SUM('FCOs'[Contract Amount])+SUM('FCOs'[Change Order Amount])-SUM('Bill Details'[LineAmount])

Best regards,

Community Support Team_yanjiang

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

@v-yanjiang-msft

that is what I had originally, neither are working.  😞
v-yanjiang-msft
Community Support
Community Support

Hi @nancymccool ,

SUM function in a calculated column do not consider context in each row, it will calculate total value of the whole column. If you want to calculate the value based on each row, directly reference the column like this:

Left to Complete =
'FCOs'[Contract Amount] + 'FCOs'[Change Order Amount] - 'Bill Details'[LineAmount]

Also, this assumes the tables 'FCOs' and 'Bill Details' already have relationship created.

 

Best regards,

Community Support Team_yanjiang

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

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.