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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jbenson
Helper III
Helper III

divide by two different table columns

I have a calculated colmn called 'Driver Hours' [Payroll] and I want to divide that by a different table called 'LoadTrackingData'[TotalFreightRate]. When I click to add a new column to my current table and just try and divide i get an error. I need this to be on a per row basis 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@jbenson , need some data

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

 

 


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Anonymous
Not applicable

Hi  @jbenson ,

When you have the same column between two tables, you can use calculated column directly:

Table1:

vyangliumsft_0-1649906055457.png

Table2:

vyangliumsft_1-1649906055458.png

Create calculated column.

Column =
var _table2amount=SUMX(FILTER(ALL('Table2'),'Table1'[ID]='Table2'[ID]),[amount1])
return
DIVIDE(_table2amount,[amount])

vyangliumsft_2-1649906055458.png

When your two tables do not have related columns, you can add Index to both tables in Power query, so that there is a relationship between the two tables.

In Power query. Add Column – Index Column – From 1.

vyangliumsft_3-1649906055460.png

Table3:

vyangliumsft_4-1649906055460.png

Table4:

vyangliumsft_5-1649906055460.png

Create calculated column.

Column2 =
var _table4amount=SUMX(FILTER(ALL('Table4'),'Table3'[Index]='Table4'[Index]),'Table4'[amount1])
return
DIVIDE(_table4amount,[amount])

vyangliumsft_6-1649906055460.png

Please click here for the pbix file

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi  @jbenson ,

When you have the same column between two tables, you can use calculated column directly:

Table1:

vyangliumsft_0-1649906055457.png

Table2:

vyangliumsft_1-1649906055458.png

Create calculated column.

Column =
var _table2amount=SUMX(FILTER(ALL('Table2'),'Table1'[ID]='Table2'[ID]),[amount1])
return
DIVIDE(_table2amount,[amount])

vyangliumsft_2-1649906055458.png

When your two tables do not have related columns, you can add Index to both tables in Power query, so that there is a relationship between the two tables.

In Power query. Add Column – Index Column – From 1.

vyangliumsft_3-1649906055460.png

Table3:

vyangliumsft_4-1649906055460.png

Table4:

vyangliumsft_5-1649906055460.png

Create calculated column.

Column2 =
var _table4amount=SUMX(FILTER(ALL('Table4'),'Table3'[Index]='Table4'[Index]),'Table4'[amount1])
return
DIVIDE(_table4amount,[amount])

vyangliumsft_6-1649906055460.png

Please click here for the pbix file

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

jbenson
Helper III
Helper III

Those did not work for me. would it be because the table i am wanting to use is set a decmial number? 

amitchandak
Super User
Super User

@jbenson , need some data

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

 

 


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors