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! Learn more

Reply
DJBrennan
Frequent Visitor

DAX RElated not working for me

Hi,

i have a fact table which contains many repetitions of a Supply Number with different usage values by date. I have a dim table that contains same supply number and various prices. I want to create a measure that multiplies usage by RElated price. 

I can set out a table that lists supply number from fact table and correctly lists the various price elements from theDim table.

 

however when I try to write a measure

cost = sum(fact[usage])* RELATED(dim[price] it doesn't work. I am advised that the related table can't be found.

 

any advice gratefully received

Denis

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @DJBrennan,

 

As the RELATED function needs a row context to work correctly, you should use SUMX function which return the sum of an expression evaluated for each row in a table in this scenario. The formula below is for your reference.Smiley Happy

cost = SUMX ( fact, fact[usage] * RELATED ( dim[price] ) )

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @DJBrennan,

 

As the RELATED function needs a row context to work correctly, you should use SUMX function which return the sum of an expression evaluated for each row in a table in this scenario. The formula below is for your reference.Smiley Happy

cost = SUMX ( fact, fact[usage] * RELATED ( dim[price] ) )

Regards

Hi I used the last answer first and that works (many thanks) but as I'm learning, I will try the alternative approach also and advise.

Again many thanks

Denis

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