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.
I have two tables with one-to-many relationship between them. One is an 'orders' table and the other is 'details' table.
Orders table have unique OrderIDs while the Details table can have non-unique OrderIDs. For example orderID 1234 in Table Orders has two matching rows in Table Details. I want to add the values in column 'Sales' of table Details and show that as "total sales" in the Orders table. Any ideas or suggestions on how to go about this? I am pretty new to PowerBI.
Solved! Go to Solution.
Create a calculated column like below in Order Table.
_Total Sales = CALCULATE(SUM('Table (2)'[sales]))
Proud to be a Super User!
Create a calculated column like below in Order Table.
_Total Sales = CALCULATE(SUM('Table (2)'[sales]))
Proud to be a Super User!
Hey @Anonymous ,
when they are connected you can get the value with a calculated column and the RELATED function.
This should work:
Sales = RELATED( Orders[Sales] )
Be aware that calculated columns are static. So the related value will be shown in the details table, but the value won't change if you do some slicing or change the context.
Hi, I saw this on another thread on here and tried it and it didn't work. I get an error saying that the tables aren't related even when I made sure that there was a relation between the two tables. I am guessing it does that cause of the one-to-many cardinality. Thanks for your response.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |