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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Dynamic RLS with multiple columns filter

Hello,

 

I need to implement a complex RLS with dynamic column filtering based on email address. I have a fact table containing the columns from the RLS table and the RLS table below:

EmailEntityTarget Segment Survey Type Equipe 
astrid.n@ALLALLALLALL
aliane.b@FranceALLALLALL
martine.t@FranceMerchantGlobal RelationshipALL
ina.s@FranceUserCustomer CareCRC B2C CESU Comearth, CRC B2C Carte Comearth
cedric.m@FranceUserCustomer CareCRC B2C CESU Comearth, CRC B2C Carte Comearth
idrissia.l@FranceClientCustomer CareCRC BtoB MC ERF
lamia.a@FranceMerchant, UserCustomer CareCRC BtoB MC ERF
valeria.z@Italy EB, Italy FMALLALLCRC BtoB MC ERF
david.b@FranceClientCustomer CareCRC BtoB SAV Sitel, CRC BtoB MC Sitel, CRC BtoC Carte Sitel, CRC BtoB MC Sitel Blois, CRC BtoC Carte Sitel Blois
christian.l@FranceUser, MerchantCustomer CareCRC BtoB SAV Sitel, CRC BtoB MC Sitel, CRC BtoC Carte Sitel, CRC BtoB MC Sitel Blois, CRC BtoC Carte Sitel Blois
adrian.p@Italy FMMerchantCustomer CareALL

 

I the end, this table will have approximately 300 email addresses, each with a specific filter, so it needs to be dynamic.

"All" means that needs to have access to all data from that column.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Solution!

I have created some Dim Tabels for every column: Dim_Entity, Dim_Target Segment , Dim_Survey Type, Dim_Equipe. These table are related to the Fact table.

I also imported the Access table, the one in the original post. This one is not related to the fact.

In the modeling I have created a Role filtered for every Dim_Table with the folowing code:

VAR _Restriction =
CALCULATETABLE(
VALUES(Access[Entity]  ------This will be changed with the column from every Dim_Table---------),
Access[Email]=USERPRINCIPALNAME()
)
VAR _RLS_Restriction =
SWITCH(
TRUE(),
OR(
"ALL" IN _Restriction,
[Entity] (------This will be changed with the column from every Dim_Table---------) IN _Restriction),
TRUE(),
FALSE()
)
RETURN
_RLS_Restriction

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Solution!

I have created some Dim Tabels for every column: Dim_Entity, Dim_Target Segment , Dim_Survey Type, Dim_Equipe. These table are related to the Fact table.

I also imported the Access table, the one in the original post. This one is not related to the fact.

In the modeling I have created a Role filtered for every Dim_Table with the folowing code:

VAR _Restriction =
CALCULATETABLE(
VALUES(Access[Entity]  ------This will be changed with the column from every Dim_Table---------),
Access[Email]=USERPRINCIPALNAME()
)
VAR _RLS_Restriction =
SWITCH(
TRUE(),
OR(
"ALL" IN _Restriction,
[Entity] (------This will be changed with the column from every Dim_Table---------) IN _Restriction),
TRUE(),
FALSE()
)
RETURN
_RLS_Restriction

Anonymous
Not applicable

Hi @Anonymous ,

Based on the description, create the relationship between two tables.

Then, try using the following formula to filter.

[Email] = USERPRINCIPALNAME() &&
(
    [Entity] = "ALL" || [Entity] = RELATED('FactTable'[Entity])
) &&
(
    [Target Segment] = "ALL" || [Target Segment] = RELATED('FactTable'[Target Segment])
) &&
(
    [Survey Type] = "ALL" || [Survey Type] = RELATED('FactTable'[Survey Type])
) &&
(
    [Equipe] = "ALL" || [Equipe] = RELATED('FactTable'[Equipe])
)

You can also view the following documents to learn more information.

Configure row-level security with the dynamic method - Training | Microsoft Learn

Solved: RLS multiple combination - Microsoft Fabric Community

Row-level security (RLS) with Power BI - Microsoft Fabric | Microsoft Learn

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you @Anonymous I forgot to mention that in my fact table I don't have the Email column so I am not sure how I can connect the two tables.  Based on your description do I need to make multiple inactive relationships for every column?

Where I have "All," there will be blank cells. I wrote "All" just for better understanding.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.