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
Sebast1aan
Regular Visitor

Anonymize column based on RLS (Only show names of own team)

Hi,

 

We have scores on multiple brokers. Each manager can see the score of his/her own team members (broker). And should be able to see the overall score of other teams, but not be able to see the score of team members in the other team.

 

With RLS I can get to the first part: Show scores of own team. But how do I get the scores per team without seeing the individual scores in that team as a manager?

 

Table with scores:

Screenshot_1-sample_data.png

Column "Manager" is successfully used for RLS

Screenshot_1-sample-data-for-RLS.png

 

Current result:

Screenshot_1-result.png

 

What I try to achieve:

Screenshot_1-achieve.png

 

Any suggestions?

Kind regards,

Sebastiaan

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Sebast1aan ,

 

1. First create the following calculation table. 

 

SubTotal = 
SUMMARIZE(
    Scores,
    Scores[Country],
    "Ave_Score", AVERAGE(Scores[Score])
)

vkkfmsft_0-1641273391152.png

 

2. Then create the inter-table relationships.

vkkfmsft_1-1641273526306.png

 

3. Create the following measure. 

 

 

Measure = 
IF (
    ISFILTERED ( Scores[Broker] ),
    CALCULATE (
        AVERAGE ( Scores[Score] ),
        USERELATIONSHIP ( Scores[Country], SubTotal[Country] )
    ),
    SUM ( SubTotal[Ave_Score] )
)

 

4. I created two roles for testing and looked at the scores for countries Belgium and Germany respectively. 

 

 

vkkfmsft_2-1641273641762.png  vkkfmsft_3-1641273658358.png

 

5. Here are the results of my test. 

 

vkkfmsft_4-1641273699030.png        vkkfmsft_5-1641273720663.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @Sebast1aan ,

 

1. First create the following calculation table. 

 

SubTotal = 
SUMMARIZE(
    Scores,
    Scores[Country],
    "Ave_Score", AVERAGE(Scores[Score])
)

vkkfmsft_0-1641273391152.png

 

2. Then create the inter-table relationships.

vkkfmsft_1-1641273526306.png

 

3. Create the following measure. 

 

 

Measure = 
IF (
    ISFILTERED ( Scores[Broker] ),
    CALCULATE (
        AVERAGE ( Scores[Score] ),
        USERELATIONSHIP ( Scores[Country], SubTotal[Country] )
    ),
    SUM ( SubTotal[Ave_Score] )
)

 

4. I created two roles for testing and looked at the scores for countries Belgium and Germany respectively. 

 

 

vkkfmsft_2-1641273641762.png  vkkfmsft_3-1641273658358.png

 

5. Here are the results of my test. 

 

vkkfmsft_4-1641273699030.png        vkkfmsft_5-1641273720663.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

bcdobbs
Super User
Super User

This sort of pattern might help:

Implement Non Visual Totals with Power BI security roles - SQLBI

I have also been playing with another way of doing it which I think might be more elegant but I can't find any documentation on it so not sure how supported it is.
Re: Tabular - Security Filtering Behaviour = None - Microsoft Power BI Community



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

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.