Forum Discussion
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
Any help is appreciated, thanks!
- Anonymous1 year ago
Hi laurahoff97 ,
As per your description, I have created two tables and created relationships for them.
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]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.
4 Replies
- Rena
Resolver II
This may seem overly obvious, but have you tried making a third measure that simply says:
Total = [AgreementTotal]-[Recordtotal]
- laurahoff97Frequent Visitor
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
- AnonymousNot applicable
Hi laurahoff97 ,
As per your description, I have created two tables and created relationships for them.
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]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.
- laurahoff97Frequent Visitor
Thank you! I was unaware I could create a measure in one data table that references columns from another.