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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Negi
Frequent Visitor

Row Level Security

Hi All,

 

I have created a Dashboard in Power BI and importing data from Azure Synapse SQL server using custom SQL. 

In the table apart from rest of the column we have added 3 Roles created which contains multiple users names in comma seperated form as per below mentioned table for each rows.

Role 1Role 2Role 3
A,B,CD,E,FG,H,I

 

and In order to implement RLS we have used 2 measures like below :-

1) Below measure extract the exact user name so that it matches with any of the above mentioned columns.

 

User Access = UPPER(SUBSTITUTE(USERNAME(),"Domain\","",1))

 

2) And then I have used below measure .

 

UserExists = 
VAR CurrentUser = [User Access] // Get the current user's name
RETURN
    IF (
        COUNTROWS (
            FILTER (
                Financial, // Replace with your table name
                [Role 1] = CurrentUser || [Role 2] = CurrentUser || [Role 3] = CurrentUser
            )
        ) > 0,
        TRUE(),
        FALSE()
    )

 

Afte that I go to Managed Roles and created 3 roles (Role 1, Role 2, Role 3 ) there and go to Table name and used this formula :-

 

[UserExists]=True

 

  

After following all the above mentioned steps when I am checking RLS as view as other users than its showing me all the data.

but when I am using view as option as roles than its showing no data which is correct as my name is not in any Role. 

But I am not able to understand why it's showing me all data if I am using other user and those users doesnot exist ?

 

This is first time I am impletment RLS , so looking forward for your valuable inputs. 

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Negi ,

What type of account are you test? Can you please share some more detail information about this issue? They should help us clarify your scenario and test to troubleshoot.

How to Get Your Question Answered Quickly  

BETWEEN, the role fields seems include multiple values with comma delimiter, I'd like to suggest you use FIND or SEARCH function to check if the current username include.

Regards,

Xiaoxin Sheng

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

Hi @v-shex-msft ,

 

I am testing using below option where I am mentioned user name in "other user" tab. 

I am new to DAX as well if you can suggest any other alternative DAX then I will test the same ?

 

 Capture.PNG

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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