Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
laurahoff97
Frequent Visitor

Adding two measurements from different tables

I have two different tables in powerbi pulled in from a database. The first is overall agreements with four columns for different types of cost and each agreement has an alloted amount for hardware/software/labor/travel. The second table is multiple records that fall under each agreement that have hardward/software/labor/travel costs that are subtracted from the agreements. I will call the agreement table and record table. 

My goal is to add the amounts up from the four columns in each of the tables and then subtract the record cost from the alloted amount in the agreement table measure. So I created measures in both of the tables separately 

Agreementtotal = Agreements[hardwarecost] + Agreements[laborcost] + Agreements[softwarecost] + Agreements[travelcost]
Recordtotal = (Records[hardwarecost] + Records[laborcost] + Records[softwarecost] + Records[travelcost])
 
The agreement IDs are included in the record table so they have been linked, however, I cannot merge these tables because there are multiple records for each agreement, therefore when merging the agreement table to the record table the agreement numbers are repeated and not calculated correctly.
 
How can I simply take those two measure from separate tables and subtract them?
I have tried DAX expressions but for some reason my syntax is not being recognized, even when I drag fields directly over from the metadata pane. Below is a simple test I can't even figure out what is wrong with. Have also tried 
test = SUM('Agreements'[software_cost])
 laurahoff97_1-1730138194468.png

 

 Any help is appreciated, thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @laurahoff97 ,

 

As per your description, I have created two tables and created relationships for them.

vkaiyuemsft_0-1730171012306.png

 

Create measure.

AgreementTotal = SUM(Agreements[HardwareCost]) + SUM(Agreements[SoftwareCost]) + SUM(Agreements[LaborCost]) + SUM(Agreements[TravelCost])

 

RecordTotal = SUM(Records[HardwareCost]) + SUM(Records[SoftwareCost]) + SUM(Records[LaborCost]) + SUM(Records[TravelCost])

 

RemainingAmount = 
Agreements[AgreementTotal] - 'Agreements'[RecordTotal]

 

vkaiyuemsft_1-1730171056263.png

 

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @laurahoff97 ,

 

As per your description, I have created two tables and created relationships for them.

vkaiyuemsft_0-1730171012306.png

 

Create measure.

AgreementTotal = SUM(Agreements[HardwareCost]) + SUM(Agreements[SoftwareCost]) + SUM(Agreements[LaborCost]) + SUM(Agreements[TravelCost])

 

RecordTotal = SUM(Records[HardwareCost]) + SUM(Records[SoftwareCost]) + SUM(Records[LaborCost]) + SUM(Records[TravelCost])

 

RemainingAmount = 
Agreements[AgreementTotal] - 'Agreements'[RecordTotal]

 

vkaiyuemsft_1-1730171056263.png

 

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Thank you! I was unaware I could create a measure in one data table that references columns from another.

Rena
Resolver II
Resolver II

This may seem overly obvious, but have you tried making a third measure that simply says:

 

Total = [AgreementTotal]-[Recordtotal]

They are on different tables and the measure won't pick up a reference to a measure outside of the table you're building it in

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors