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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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 {"[email protected]"}, // 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 {"[email protected]","[email protected]"}, 
    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 {"[email protected]"}, // 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 {"[email protected]","[email protected]"}, 
    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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors