Forum Discussion
Calculated Column - 2 Tables
Looking for help with a calculated column between two different tables.
The end goal is for the calculated column to be: (Hours at Completion) - (Travel Time)
Hours at Completion is on one table, Travel Time is on a different table.
The relationship between the two tables is Many:1.
How can I accomplish this?
If Table 1 is on the many side, you can use this expression to get your result
NewColumn = Table1[Hours at Completion] - RELATED(Table2[Travel Hours])
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
4 Replies
- parry2kSuper User
Anonymous share the sample data and expected output. Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490Although you can try to add column in the table that is on the many sides by using DAX function called RELATED to refer column from one side.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- AnonymousNot applicable
Table 1:
Project Code Hours at Completion Project A 90 Project B 80 Project C 102 Table 2:
Project Code Travel Hours Project A 5 Project B 0 Project C 4 Desired Output: (Hours at Completion - Travel Hours)
Project Code (Hours at Completion - Travel Hours) Project A 85 Project B 80 Project C 98 - mahoneypatMicrosoft Employee
If Table 1 is on the many side, you can use this expression to get your result
NewColumn = Table1[Hours at Completion] - RELATED(Table2[Travel Hours])
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat