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
Anonymous
Not applicable

Create Calculated Column by dividing columns from two different TABLES

I want to create a calculated column by dividing columns from 2 tables linked with each other. It is giving me wrong answer. How to do this. Thanks in advance!

8 REPLIES 8
Anonymous
Not applicable

Hi @Anonymous ,

 

From this:

Only measure is giving the correct value and not the calculated column.

I have put the slicer of Start Time on the report based on which it will calculate max speed.

 

It seems that the max speed is dynamiclly based on the selected date period in slicer, right?

If so, calculated column is not available since it is static and could not be changed. You have to use measure instead.

 

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

Anonymous
Not applicable

@TheoC Thanks for your patience. I am sharing the details.

Speed1 = SUM(Table2[Volume])/sum(Table1[Time])
Time = (DATEDIFF('Table1'[start time], 'Table1'[end time],SECOND))

These are two tables linked with each other on ID.These are two tables linked with each other on ID.If I divide using measure, it gives correct value but  if I create a calculated column, it gives wrong value.If I divide using measure, it gives correct value but if I create a calculated column, it gives wrong value.

I don't know how to share the PBIX file with you.

 

@Anonymous if there's a relationship using the IDs in both tables, then create following calculated columns:

 

colRelated = RELATED ( [Volume] ) // This brings the Volume column into the other table

colDivision = DIVIDE ( [Volume] , [Time] , 0 ) // This divides Volume by Time.

 

Hope this helps.

Theo

 

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Anonymous
Not applicable

@TheoC Thanks for answering. It works but gives wrong values.

Other info- I have two tables related to each other on ID.

Table 1 has columns-Start time, End Time, ID

Table 2 has columns- ID, Volume

 

Speed = divide volume by Time difference btw start and end time. And then need to further divide by max speed.

 

Only measure is giving the correct value and not the calculated column.

I have put the slicer of Start Time on the report based on which it will calculate max speed.

@Anonymous What measure are you using? 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Anonymous
Not applicable

@TheoC  

Measure 2 = sum('table2'[volume])/Sum('table1'[Time])
 
Calculated column --> Time = (DATEDIFF('table1'[start time], 'table1'[end_time],SECOND))

@Anonymous can you provide me with the outputs that you are seeing or provide example data please. Unfortunately, it's very challenging try to understand why a basic measure works as required in this instance but there are complications with the column.

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

TheoC
Super User
Super User

Hi @Anonymous 

 

Can you try this:

 

Column = 

VAR _1 = SUM ( Table1[Amount] )
VAR _2 = SUM ( Table2[Amount] )
VAR _3 = _1 / _2

RETURN 

IF ( _3 = 0 , 0 , _3 )

 

Hope this helps.

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors