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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ashishg
Advocate I
Advocate I

RLS security based on State and Company table

ashishg_0-1673257999673.png

Requirement - Apply RLS

 

  1. Fact table should be filer base on email address
  2. one user could be assign to multiple state but same user can be assign withing only one company of any one particular state 

What DAX i will write to filter data
NOTE- IF user have an access of two state like MH and MP , but its having an only one company access "google" then he can be only show data of google company not for other company from another state

@amitchandak @Greg_Deckler 

1 ACCEPTED SOLUTION

HI @ashishg,

Did you mean the company RLS table is the role settings you want to filter on these tables? Is there any index fields include in your ‘State RLS’ table?

I'd like to suggest you can use the current username and index field to find out the first ‘State’. Then you can use the ‘State’ as condition to lookup the ‘report fact’ table by ‘State’ and ‘product ID’ to find out first company.

After these steps, you can extract the result 'company' and current 'username' to apply RLS filter on table feilds.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
ashishg
Advocate I
Advocate I

@v-shex-msft 

here is the tables , I'm not able to attached pbix file, Relationship as shown in above image

ReportFact

ProductIDStatePriceCompany
1MH20Google
2MH20Google
3MH10Google
4MH30

 

 

2. CompanyRLS

EmailCompany
abc@gmail.comGoogle
pqr@gmail.comamazon

 

3. StateRLS

EmailState
abc@gmail.comMH
pqr@gmail.comKL
abc@gmail.comMP

HI @ashishg,

Did you mean the company RLS table is the role settings you want to filter on these tables? Is there any index fields include in your ‘State RLS’ table?

I'd like to suggest you can use the current username and index field to find out the first ‘State’. Then you can use the ‘State’ as condition to lookup the ‘report fact’ table by ‘State’ and ‘product ID’ to find out first company.

After these steps, you can extract the result 'company' and current 'username' to apply RLS filter on table feilds.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
v-shex-msft
Community Support
Community Support

Hi @ashishg ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.