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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

RLS not working inactive relation and measure

I just implemened RLS in my report. Some visuals show an error:

Knipsel.png

 

I have a table "accountM":

Accountmanager | email

John                  | john@power.bi

 

This table is connected to the "bezoekrapport 5-2" with an inactive relation on "accountmanager".

This relation is inactive, because through an other table the "accountM" table already has a relation with table "bezoekrapporten 5-2"

 

The relation is used for a visual that counts the amount of visits made by an account manager.

To do this I have used the following measure:

Count bezoeken = 
  CALCULATE(COUNT('Bezoekrapport 5-2'[Outlet]);
      USERELATIONSHIP(accountM[Accountmanager];'Bezoekrapport 5-
      2'[accountmanager]

 

What can I do to still make this work?

5 REPLIES 5
Anonymous
Not applicable

@Anonymous,

instead of using userelationship() function, use ALL and FILTER manually to create the measure. There is a similar thread for your reference.

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/aae38bbc-a4bf-4e86-97f1-c89dc65c1867/userelationship-function-cannot-be-used-while-querying-table-mytable-because-of-the-row-level?forum=sqlanalysisservices

Regards,
Lydia

Anonymous
Not applicable

Hi @Anonymous

 

Thank you very much for your reply.

I tried to use Filter and ALL:

 

Count bezoeken = 
  CALCULATE(
     COUNT('Bezoekrapport 5-2'[Outlet]);
       FILTER(ALL('Bezoekrapport 5-2'[accountmanager];
           CONTAINS( VALUES(accountM[Accountmanager]);accountM[Accountmanager];
                    'Bezoekrapport 5-2'[accountmanager] )
                                )
                                )

However it does not display the same number as when I use the USERELATIONSHIP(). Can you tell me what I should change?

Anonymous
Not applicable

@Anonymous,

Please share dummy data of your table for us to analyze.

Regards,
Lydia

Anonymous
Not applicable

@Anonymous

 

Table 1:

Account M 
Person A 
Person B 
Person C 
  

 

Table 2:

CompanyVisit dateAccountmanager 
Company A01-01-17Person A 
Company B02-01-17Person A 
Company C03-01-17Person A 
Company D04-01-17Person A 
Company B05-01-17Person A 
Company C06-01-17Person A 
Company A07-01-17Person B 
Company E08-01-17Person B 
Company C09-01-17Person B 
Company A10-01-17Person B 
Company D11-01-17Person B 
Company C12-01-17Person B 
    

 

I would like to count the amount of visits per account manager. 

I can not make an active relation with account M and account manager, because account M already has a infleunce on Account manager through an other chain of relationships.

 

 

 

Anonymous
Not applicable

@Anonymous,

Create the measure in Table 1 using your two different DAX, they return same result when dragging the Account M filed of Table 1 and the measure in a visual.

Regards,
Lydia

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors