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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
yuktadiya
Helper III
Helper III

create Dynamic RLS in powerbi

hi All

Question  need to create Dynamic RLS. so need to login either line manager or billing focal. how to write dax

id line manager email billing focal email
1dk@gmail.comkr@gmail.com
2raksh@gmail.comab@gmail.com
3kum@gmail.comci@gmail.com

 

Regards

Dilip

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @yuktadiya ,

 

Here are the steps you can follow:

1. You can put the following dax into the RLS Manage roles.

var _line=
CALCULATETABLE(
    VALUES('Table'[id ]),
    FILTER('Table','Table'[line manager email ]=USERPRINCIPALNAME()))
var _bill=
CALCULATETABLE(
    VALUES('Table'[id ]),
    FILTER('Table','Table'[billing focal email]=USERPRINCIPALNAME()))
return
IF(
    'Table'[id ] in _line || 'Table'[id ] in _bill ,TRUE())

vyangliumsft_0-1702873978800.png

2. Then publish it to Power BI Service, click Security Edit Role in the dataset of the corresponding report, and finally share it to the corresponding user.

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

3. Result:

vyangliumsft_1-1702873978802.png

 

 

Best Regards,

Liu Yang

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi  @yuktadiya ,

 

Here are the steps you can follow:

1. You can put the following dax into the RLS Manage roles.

var _line=
CALCULATETABLE(
    VALUES('Table'[id ]),
    FILTER('Table','Table'[line manager email ]=USERPRINCIPALNAME()))
var _bill=
CALCULATETABLE(
    VALUES('Table'[id ]),
    FILTER('Table','Table'[billing focal email]=USERPRINCIPALNAME()))
return
IF(
    'Table'[id ] in _line || 'Table'[id ] in _bill ,TRUE())

vyangliumsft_0-1702873978800.png

2. Then publish it to Power BI Service, click Security Edit Role in the dataset of the corresponding report, and finally share it to the corresponding user.

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

3. Result:

vyangliumsft_1-1702873978802.png

 

 

Best Regards,

Liu Yang

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

mh2587
Super User
Super User

-- Try this one
RLS_Filter = 
VAR CurrentUser = USERNAME()
RETURN
    IF (
        -- Check if the user is a line manager
        CALCULATE (
            COUNTROWS (
                FILTER (
                    'YourTable',
                    'YourTable'[line manager email] = CurrentUser
                )
            )
        ) > 0,
        1,
        -- Check if the user is a billing focal
        IF (
            CALCULATE (
                COUNTROWS (
                    FILTER (
                        'YourTable',
                        'YourTable'[billing focal email] = CurrentUser
                    )
                )
            ) > 0,
            1,
            0
        )
    )

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



can you please share through a powerbi sample file 

 

thanks 

Dilip

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.