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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jeanramonyap
Helper I
Helper I

Sum of column values from different tables

I have 2 tables with a common column. The relationship has already been established. I want to add the values in the columns to get a total score for each row. How do I do this? See example tables below. The supplier column is the common column. I want the final table to be all the metrics and the supplier and the total score.

 

Table 1

SupplierMetric 1Metric 2
Supplier A510
Supplier B1015
Supplier C015

 

Table 2

SupplierMetric 3Metric 4
Supplier A520
Supplier B1515
Supplier C05

 

Final table

SupplierMetric 1Metric 2Metric 3Metric 4Total Score
Supplier A51052040
Supplier B1015151555
Supplier C0150520

 

1 ACCEPTED SOLUTION
rsbin
Super User
Super User

@jeanramonyap ,

You really don't need to create a new table.

Just take your Table1 and add the following 3 Calculated Columns:

Metric3 = RELATED( Table2[Metric 3] )
Metric4 = RELATED(Table2[Metric 4] )
Total = [Metric 1] + [Metric 2] + [Metric3] + [Metric4]

SupplierMetric 1Metric 2Metric3Metric4Total

Supplier A 5 10 5 20 40
Supplier B 10 15 15 15 55
Supplier C 0 15 0 5 20

The Related function works because you have created the Supplier relationship.

If you really do need or want a separate table, just copy Table1 and give it another name (i.e "Final Table),

Regards,

View solution in original post

4 REPLIES 4
rsbin
Super User
Super User

@jeanramonyap ,

You really don't need to create a new table.

Just take your Table1 and add the following 3 Calculated Columns:

Metric3 = RELATED( Table2[Metric 3] )
Metric4 = RELATED(Table2[Metric 4] )
Total = [Metric 1] + [Metric 2] + [Metric3] + [Metric4]

SupplierMetric 1Metric 2Metric3Metric4Total

Supplier A 5 10 5 20 40
Supplier B 10 15 15 15 55
Supplier C 0 15 0 5 20

The Related function works because you have created the Supplier relationship.

If you really do need or want a separate table, just copy Table1 and give it another name (i.e "Final Table),

Regards,

Amazing! It worked! You are a lifesaver! 

amitchandak
Super User
Super User

@jeanramonyap , You need to create common supplier dimension

 

then you can 4 measure and 1 sum of all 4

 

Total = Sum(Table1[Metric1])+ Sum(Table1[Metric2])+ Sum(Table2[Metric3])+ Sum(Table2[Metric4])

 

https://amitchandak.medium.com/power-bi-when-i-asked-you-to-create-common-tables-a-quick-dax-solutio...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

This doesn't work because I don't want the sum per column. I want the evaluation to be row by row. Your recommendation will sum the values for metric 1 + sum of values for metric 2 and so on, which is something I don't want.  The final table has to look like this. 

 

SupplierMetric 1Metric 2Metric 3Metric 4Total Score
Supplier A51052040
Supplier B1015151555
Supplier C0150520

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.