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

RLS or Modeling for user role based on dual condition

Hello Everyone,

I have 2 data sets, User and dealers under them & another one is Opportunities data where I have leads data from buyers from different countries. Both the tables are modeled based on dealer id.

Senthil_Kumar_2-1658491162302.png

The user in above data have different roles, my requirement now is for just role 3 user id's, they should see only Opportunities of their respective coutry and for rest of the role they can see all countries data. But with my current modeling they are able to see all data based on dealer id  modeling.

Example:  user id 3  has access to OpportunityId 4 & 5 but he should see only OpportunityId 5 since his country is US.

Similary User id 5 should see only OpportunityId 6 & not 8.

But for a super user like say User id 1 he should see both OpportunityId 1 & 2 which is of CA and US.

Could any one help me with how to acheive this based on current modeling and role based user's country as well.

3 REPLIES 3
Senthil_Kumar
Frequent Visitor

@v-kkf-msft , In my case RLS is based on User id, each user has set of dealers under them and also each user has a role defined to them. Above case will not fit perfectly to my scenario and also you have used static role number, what if user other than role 3 will login? It has to be completely dynamic based on avaiable role and user id.

v-kkf-msft
Community Support
Community Support

Hi @Senthil_Kumar ,

 

First create a relationship between [Dealer id].

 

vkkfmsft_0-1658825552838.png

 

Then create the following filters for role 3.

 

[User role] = 3 
CALCULATE (
    COUNTROWS ( Opportunities ),
    INTERSECT (
        SUMMARIZE (
            Opportunities,
            Opportunities[Dealer id],
            Opportunities[Opportunity_Country]
        ),
        SUMMARIZE (
            FILTER ( User_Dealer, User_Dealer[User role] = 3 ),
            User_Dealer[Dealer id],
            User_Dealer[User Country]
        )
    )
) > 0

vkkfmsft_2-1658825664265.png

vkkfmsft_1-1658825633434.png

 

vkkfmsft_3-1658825707625.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.

 

 

lbendlin
Super User
Super User

Sounds like you need a composite key "Dealer-Country"  in both tables.

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.