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
Alex_Ra
Frequent Visitor

USERELATIONSHIP impact on other relationships

Hi, I'm trying to understand how USERELATIONSHIP() works and went into question how does it decide which undefined active relationship to use when there is more than one to the same table.


In my example both tables 'users' and 'usage' have active relationships to the table 'calendar' and one inactive 1 to 1 relationship between them. I have two measures created:

 

Measure_usage = calculate(sum(usage[usage]), userelationship(usage[user_id], users[user_id]))
Measure_users = calculate(count(users[user_id]), userelationship(usage[user_id], users[user_id]))

 

 

Then I create two table visuals with calendar[date] field and those measures to test which calendar relationship will it use - results are that both measures use relationship users[created_at]<->calendar[date].

 

Could anyone explain why is it so?

 

Alex_Ra_0-1701976419833.pngAlex_Ra_1-1701976438149.png

 

2 REPLIES 2
Fowmy
Super User
Super User

@Alex_Ra 

Your model has to be amended by adding a new dimension table for users and creating relationships with usage and users tables. Remove current inactive relationship between these two tables to avoid ambiguity.


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Alex_Ra
Frequent Visitor

This is just an example model to show this issue when PowerBI decides itself which relationship to use.

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.