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

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.

Reply
brettmeyers
Regular Visitor

Create a caluculation between two tables

I am a NEWBIE to Power BI and DAX. Any help is greatly appreciated!

 

I have 2 tables (screenshots attached).

 

Table 1: TKHours

Table2: PPEAmounts

 

What I am trying to acheive is:

  • PPEAmounts[Amount] / TKHours[Hours]

Thank you in advance for any feedback,

Brett

 

 

2016-08-29 (1).png2016-08-29.png

2 ACCEPTED SOLUTIONS
ankitpatira
Community Champion
Community Champion

@brettmeyers You need to create relationship between two tables using common field such as Jobnumber in your case. Once relation is there you can simply create calculated column to get value for each row or create a measure to get difference using sum(PPEAmounts[Amount]) / sum(TKHours[Hours]).

View solution in original post

v-shex-msft
Community Support
Community Support

Hi brettmeyers,

 

Ankipatira ‘s point seems well, you could also use LOOKUPVALUE function to create a measure to achieve your requirement.

 

I find these tables all have a jobnumber column, I use this column as the search column: (Since I can’t find a same jobNumber between two tables, I have modified the jobnumber)

 

Dax:

Measure = SUM(PPEAmounts[Amount])/LOOKUPVALUE(TKHours[Hours],TKHours[JobNumber],VALUES(PPEAmounts[JobNumber]))

 

Result: (I added a column to store and display the measure)

Capture2.PNG 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi brettmeyers,

 

Ankipatira ‘s point seems well, you could also use LOOKUPVALUE function to create a measure to achieve your requirement.

 

I find these tables all have a jobnumber column, I use this column as the search column: (Since I can’t find a same jobNumber between two tables, I have modified the jobnumber)

 

Dax:

Measure = SUM(PPEAmounts[Amount])/LOOKUPVALUE(TKHours[Hours],TKHours[JobNumber],VALUES(PPEAmounts[JobNumber]))

 

Result: (I added a column to store and display the measure)

Capture2.PNG 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
ankitpatira
Community Champion
Community Champion

@brettmeyers You need to create relationship between two tables using common field such as Jobnumber in your case. Once relation is there you can simply create calculated column to get value for each row or create a measure to get difference using sum(PPEAmounts[Amount]) / sum(TKHours[Hours]).

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors