Forum Discussion

danielPrieto's avatar
danielPrieto
Icon for Advocate I rankAdvocate I
8 years ago

Relationships with bridge tables

Hi,

 

I have a data model like this:

 

 

 

I have a Fact Table (UserEvaluation) and some dimensions (User, Group and Client). The relation between Group and User y m:n so we also have a bridge table (BridgeUserGroup).

 

I want to make a report with filters by Clients and Groups. So, If I select a Client I want to see all their groups and all their users (whether or not they are in a group).  I would like to have the possibility of filter one group to see their evaluation results. The problem is that if there are users that do not belong to any group they will never appear. This occurs because I can't be other active relationship between client and users.

 

If it is not clear, I can provide an example or share a .pbix. 

 

Does anyone know how to model this type of situation?

 

Regards,

Dani

 

9 Replies

    • danielPrieto's avatar
      danielPrieto
      Icon for Advocate I rankAdvocate I

      Thanks Greg_Deckler

       

      I know that function USERELATIONSHIP can help but I don't know how in this case. 

       

      Suppose the following tables:

       

      User:

       

      UserIDUsernameClientID
      1User_11
      2User_21
      3User_31
      4User_41
      5User_51
      6User_62
      7User_72
      8User_82

       

      Group:

      GroupIDGroupNameClientID
      1Group_11
      2Group_22
      3Group_32

       

      BridgeUserGroup:

      UserIDGroupID
      11
      21
      72
      83

       

      Client:

      ClientIDClienName
      1Client_1
      2Client_2

       

      UserEvaluation:

      UserIDCourseIDScore
      112
      126
      135
      228
      239
      316
      326
      413
      427
      516
      528
      532
      617
      622
      638
      719
      727
      732
      816
      829
      836

       

      As you can see we have several users who are not in any group. So I want a report like this


      But if I filter by Client1 I can see the following:

      I can see the users that belong to a group but I would like to see all the user's results of this client, unless I select the group in the corresponding filter.

       

      Can you explain me how use the USERELATIONSHIP function in this case?

       

      You can dowload a .pbix in this link.

       

      Thanks in advance,

      Dani