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
KeenEye
New Member

Selecting a measure based on one of two relationships between a fact and dimension table?

I need 2 measures that use 1 of 2 measures in a fact table, the measure selected is to be based on the two joins with the dimension table.
The Fact table has 2 Product codes (Product 1 and Product 2) and 2 measures -Measure1 and Measure 2.
I have a Product dimension with a Product code.
Join 1 = Dim.Productcode = Fact.Productcode_1 (active relationship)
Join 2 =  Dim.Productcode = Fact.Productcode_2 (inactive relationship).

My new measures
ProductMeasure1 needs to be to use join 1 and sum(Measure1) 
ProductMeasure2 needs to be to use join 2 and sum(Measure2) .

ProductMeasure1 seems to work:-
ProductMeasure1 = SUMX(FILTER( 'FactTable'
, RELATED('DimTable'[Productcode])
= FactTable[Fact.Productcode_1]
)
,FactTable[Measure1])

ProductMeasure2 doess not work because of the USERELATIONSHIP, probably not place or construction:-
ProductMeasure1 = SUMX(FILTER( 'FactTable'
, RELATED('DimTable'[Productcode]) 
I need to use this relationship : USERELATIONSHIP('FactTable'[Productcode2],'DimTable'[Productcode])
= FactTable[Fact.Productcode_2]
)
,FactTable[Measure2])

Any ideas or other solutions ?

Thanks in advance

1 ACCEPTED SOLUTION

Thanks  for your fast reply and solution. I will try them and share my findings 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@KeenEye , it should be like

 

For join 1 , you need a measure like // Dim.Productcode = Fact.Productcode_1 (active relationship)

 

calculate(Sum(FactTable[Measure1]) )

 

for join 2

calculate(Sum(FactTable[Measure1]),USERELATIONSHIP('FactTable'[Productcode2],'DimTable'[Productcode]) )

 

 

refer

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

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

Thanks, it works and is much simpler than I thought.
Great support 👍 😃

Thanks  for your fast reply and solution. I will try them and share my findings 

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.