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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
powerbianalyst3
New Member

Filter one table based on slicer for another table with RLS?

Hi,

I have table 1 with a column containing cost units, and table 2 with a column containing GL accounts. I have a slicer filtering on the cost units. Based on the selection of this slicer, I would like to display a specific set of GL accounts. This is however, only for specific users, not everyone. Hence this needs to be combined with RLS.

How can I do this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @powerbianalyst3 ,

Do specific users need to see all [Cost Unit] values? Do specific users need to see some of the [GL Account] values when no slicer is selected?
For SPECIFIC USERS, if it is necessary for them to see a portion of the table 2 table, this portion can be made subject to RLS rules. Under this part of the rule, if you want to realize that you can see different values of [GL Account] under different [Cost Unit] slicers, you can apply filter.
For example, we create a new Role:

vcgaomsft_0-1706164971998.png
this time:

vcgaomsft_1-1706165004861.png

then we create a new measure like:

 

Measure = 
VAR _user = USERPRINCIPALNAME()
VAR _Cost_Unit = SELECTEDVALUE('Table1'[cost units])
VAR _GL_Account = SELECTEDVALUE('Table2'[GL accounts])
VAR _filter = 
SWITCH(
    TRUE(),
    COUNTROWS(ALLSELECTED('Table1'[cost units]))=COUNTROWS(ALL('Table1'[cost units])),1, // Returns all results when selected in full, removing this line returns null when there are no options.
    _user IN {"aa@consto.com"}, // Here is to consider different accounts under the same Role to select the same Cost Unit return different GL Account situation.
    SWITCH(
        _Cost_Unit,
        0.1, IF(_GL_Account IN {"Account A","Account C","Account H"},1), // When selecting cost unit=0.1, I want to return Account A,Account C and Account H.
        0.2, IF(_GL_Account IN {"Account C","Account H"},1),
        0.3, IF(_GL_Account IN {"Account H"},1),
        ...
        ...
    ),
    _user IN {"bb@consto.com","bb@consto.com"}, 
    SWITCH(
        _Cost_Unit,
        0.1, ...,
        0.2, ...,
        0.3, ...,
        ...
        ...
    ),
    ...
    ...
)
RETURN
_filter

 

vcgaomsft_3-1706165654856.png


Output:

vcgaomsft_2-1706165456456.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @powerbianalyst3 ,

Do specific users need to see all [Cost Unit] values? Do specific users need to see some of the [GL Account] values when no slicer is selected?
For SPECIFIC USERS, if it is necessary for them to see a portion of the table 2 table, this portion can be made subject to RLS rules. Under this part of the rule, if you want to realize that you can see different values of [GL Account] under different [Cost Unit] slicers, you can apply filter.
For example, we create a new Role:

vcgaomsft_0-1706164971998.png
this time:

vcgaomsft_1-1706165004861.png

then we create a new measure like:

 

Measure = 
VAR _user = USERPRINCIPALNAME()
VAR _Cost_Unit = SELECTEDVALUE('Table1'[cost units])
VAR _GL_Account = SELECTEDVALUE('Table2'[GL accounts])
VAR _filter = 
SWITCH(
    TRUE(),
    COUNTROWS(ALLSELECTED('Table1'[cost units]))=COUNTROWS(ALL('Table1'[cost units])),1, // Returns all results when selected in full, removing this line returns null when there are no options.
    _user IN {"aa@consto.com"}, // Here is to consider different accounts under the same Role to select the same Cost Unit return different GL Account situation.
    SWITCH(
        _Cost_Unit,
        0.1, IF(_GL_Account IN {"Account A","Account C","Account H"},1), // When selecting cost unit=0.1, I want to return Account A,Account C and Account H.
        0.2, IF(_GL_Account IN {"Account C","Account H"},1),
        0.3, IF(_GL_Account IN {"Account H"},1),
        ...
        ...
    ),
    _user IN {"bb@consto.com","bb@consto.com"}, 
    SWITCH(
        _Cost_Unit,
        0.1, ...,
        0.2, ...,
        0.3, ...,
        ...
        ...
    ),
    ...
    ...
)
RETURN
_filter

 

vcgaomsft_3-1706165654856.png


Output:

vcgaomsft_2-1706165456456.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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