Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Mattyt510
Regular Visitor

Creating appropriate relationships for data model with multiple Fact tables

Hi all,

I'm quite new to building models and reports in Power BI and would greatly appreciate some advice on modelling.
I'm having issues configuring my model to be able to determine what Functions different Users have access to in a system, without having ambiguity in the model.

This is how my model looks currently:

Mattyt510_0-1728966035807.png

In this system users can be assoicated to Functions in two different ways. Either User -> Profile -> Role -> Function or User -> Role -> Function, hence the circular model.

The UserRoles, UserProfiles and ProfileRoles Fact tables have been derived from a single relationship table, which was formatted like this like below, and I split out in Power Query.

NameNameTypeAssocNameAssocTypeRelationshipType
User123URRole123User to Role
User246UPProf678User to Profile
Prof678PRRole123Profile to Role

I've tested using the relationship as a singular relationship table, but had issues with visualising the Users -> Roles relationship when the role is associated through a profile (Such as User246 being related to Role123 in the above table), and splitting the Fact table resolved this issue.

I've also tested using two User dimension tables to split the two pathways, however, my models relationships break at the ProfileRoles table.

I can build visuals for Users to Profiles, Users to Roles, Roles to users via profiles, and Roles to Functions, however, the report breaks down when trying to go from Users or Profiles to Functions, through roles. I've played with different cross filtering but haven't had any luck.

Any help/advice is appreciated.

Regards,

Matty

1 ACCEPTED SOLUTION

Hi @Mattyt510 ,

 

The question is the fact that you have both tables making the filter for "different sides" so when you add the names and the functions to your table it does not get the correct value.

 

Once again I believe you need to revise the way you have your model setup but with the current setup you can force the filters for function to be overwritten by the relationships using a dax measure:

Roles / function count = COUNTROWS( CROSSJOIN('RolesFunctions (2)', 'UserRole (2)'))

 

If you add this in you visualization you get the following result:

 

 

MFelix_1-1729096179870.png

 

MFelix_2-1729096199509.pngMFelix_3-1729096220673.pngMFelix_4-1729096231853.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
v-jialongy-msft
Community Support
Community Support

Hi @Mattyt510 

Can you provide detailed sample pbix file and the results you expect.So that I can help you better. Please remove any sensitive data in advance.

 

 

 

 

Best Regards,

Jayleny

 

Hi @v-jialongy-msft,

Here is a sample of my data set, unfortunately I've had to create mock data in case of any sensitive content, however the mock data set includes all scenarios of how users are related to functions.
User Function Sample.pbix
User Function sample.xlsx
I've created some basic visuals that I have in my report (although is missing details from dimension tables that in in my dataset). In the final page I am hoping to relate Users to Functions, even if there are seperate visuals for Users -> Profiles -> Roles -> Functions and Users -> Roles -> Functions, I've been unable to show this relationship in either scenarios.

Please let me know if the link doesn't work, I'm unable to upload files to this forum.

Regards

Hi @Mattyt510 ,

 

The question is the fact that you have both tables making the filter for "different sides" so when you add the names and the functions to your table it does not get the correct value.

 

Once again I believe you need to revise the way you have your model setup but with the current setup you can force the filters for function to be overwritten by the relationships using a dax measure:

Roles / function count = COUNTROWS( CROSSJOIN('RolesFunctions (2)', 'UserRole (2)'))

 

If you add this in you visualization you get the following result:

 

 

MFelix_1-1729096179870.png

 

MFelix_2-1729096199509.pngMFelix_3-1729096220673.pngMFelix_4-1729096231853.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you @MFelix,

The DAX measure you've provided works well for achieving the results I'm looking for currently.

I agree with your point regarding revising the model to avoid filtering relationships both ways, however I'm unsure of what approach should be taken to avoid the issues I'm facing in this case.

Many thanks!

MFelix
Super User
Super User

Hi @Mattyt510 ,

 

Power BI is optimized to use a star schema, with one to many relationships with single filter, in you case you have  several bi directional  that you can see in the image below:

MFelix_0-1728982220127.png

Some of the best practices is to in some cases join some of the dimension tables into one this depends on the information and level of granularity.

In your case I believe that the fact that you have all of these bi directional will lead to a circular relationship that breaks the model.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix, thank you for your advice.

 

Unfortunately there are many bi-directional relationships as a significant function of my report I'm hoping to have is identifying Functions associated with a User. Which in this case involves filtering across multiple Dimension and Fact tables (with how I have the model built currently.)

The bi-directional relationship between Profiles and ProfileRoles is also required to associate roles to users, where the rolea are inherited from a profile.

I have tried leaving the assoiation Fact table in its original form, however, I'm unsure how to navigate around Profiles being in two columns, as I will need to self reference the table to determine the User -> Profile -> Role relationship.

Mattyt510_0-1729045371038.png


Thanks for your help.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.