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

Calculated Column Depends on another Calculated Column (Race condition)

Hi 

 

I have the following Tables:

Order table

Part NumberPriceQuantitySeller ScalarTotal Scalar
Part 1102

0.8

0.8

Part 1124

1

1

Part 252

1

1

Part Numbers table

 

Part NumberTotal Scalar
Part 11.8
Part 2 1

 

I want to use this information to calculate a normalized scalar, so I can make a Weighted Average Price.

At the moment I do it by duplicating the Order table and adding a calculated Column Normalized Scalar.

New table

 

Part NumberPriceQuantitySeller ScalarTotal ScalarNormalized Scalar
Part 1102

0.8

0.8

0.8/1.8

Part 1124

1

1

1/1.8

Part 252

1

1

1/1

 

The problem is that the New table does not look like the one above, but more like the one below.

Part NumberPriceQuantitySeller ScalarTotal ScalarNormalized Scalar
Part 1102

0.8

0.8

 

Part 1124

1

1

 

Part 252

1

1

 

 

All the values become empty because Seller Scalar divided by what I assume is an empty value equals nothing.

 

I assume this is because the New table is calculated first followed by the Part Numbers table.

This means that when the Normalized Scalar is calculated the values needed from Total Scalar in Part Numbers has yet to be calculated. 

 

I think this would be solved by having Orders be calculated first followed by Part Numbers and at last a New table with Normalized Scalars. 

However, I don't know how to control when a table is calculated in relation to all other tables.  

 

Thank you for your time.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @parry2k 

 

Your reply was not the answer but it did lead me to it.

 

The problem was some of my Relations were way off, so I think Power BI couldn't figure out what was what. 

 

But anyway thanks for pointing in the right direction 😄 

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

@Anonymous assuming you have a relationship between these tables and part number table is on one side of the relationship, you can add new column like this

 

New Scalar Column = 
DIVIDE ( Order[Scalar Value], RELATED( PartTable[Total Scalar] ) ) 

 

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!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi @parry2k 

 

Your reply was not the answer but it did lead me to it.

 

The problem was some of my Relations were way off, so I think Power BI couldn't figure out what was what. 

 

But anyway thanks for pointing in the right direction 😄 

dax
Community Support
Community Support

Hi @Anonymous , 

It seems that there is no relationship between two tables, right? You could try to refer to below expression to create calculated column

Column = CALCULATE(SUM('Order table'[Seller Scalar]))/MINX(FILTER('Part Numbers','Part Numbers'[Part Number]=EARLIER('Order table'[Part Number])),'Part Numbers'[Total Scalar])

 

Best Regards,
Zoe Zhi

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

 

@Anonymous glad to hear that issue is resolved, that's what matters. cheers!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@Anonymous glad it worked out, it is always tough to reply when looking at the problem because sometimes you don't have the full picture. Anyhow, the goal is to get you over the line and which seems like to be the case. Cheers!!

 

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!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.