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

Calculated Column from two tables related to one another with a 3'rd table

adriandumitru_0-1675149641873.png

Hello,

I have 3 tables: Query1 at Product and Invoice Level; Stock_KLG at Product Level; and DimProduct at Product Level

Query1 has an old Product code and Stock_KLG a new Product code. They are connected to one another by a mapping table DimProducts.

I want to create a calculated column [Stock_KLG]Quantity * Average( [Query1]Unit_Cost )

I tried with related and allexcept, but because of a 3'rd table it doesn't work.

Thank you!

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

which is the 3rd table?

if you are adding a calculated column in DimProducts, can try this code

NewColumn=SUMX(RELATEDTABLE(Stock_KLG,Stock_KLG]Quantity)*AVERAGEX(RELATEDTABLE(Query1,Query1[Unit_Cost])

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

which is the 3rd table?

if you are adding a calculated column in DimProducts, can try this code

NewColumn=SUMX(RELATEDTABLE(Stock_KLG,Stock_KLG]Quantity)*AVERAGEX(RELATEDTABLE(Query1,Query1[Unit_Cost])

Anonymous
Not applicable

Great. Looks like it works in this form:

[Stock_KLG]Quantity * AVERAGEX(RELATEDTABLE(Query1,Query1[Unit_Cost])

 

Thank you!

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.