Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi,
How can I test the Row Level Security (RLS) in the report that uses Power BI Service Live Connection? Please let me know.
Regards,
Keerthi
Solved! Go to Solution.
I have had success testing with another method that can also be used to mimic RLS on a shared dataset. In this use case for mimicking RLS, it's important that the users don't have build access to the dataset and can only export summarized data from any visuals, as they'd otherwise be able to access everything.
Being a live connection, all of the measures I'm mentioning below are report-level measures. Here are the steps:
SAMPLE_MEASURE =
VAR _user = [ACTIVE_USER]
RETURN
CALCULATE( [TARGET_MEASURE], USER_TABLE[EMAIL] = _user )
This isn't practical for testing across a wide range of measures, but it does allow for testing different users across a number of measures, by turning [ACTIVE_USER] into variable that can be set in one place (within that measure).
This does need to be set as a variable, which is just a manipulation of the calculation order in DAX, computing [ACTIVE_USER] before [SAMPLE_MEASURE] and then making that availalbe for the CALCULATE() function.
In the scenario where this is used to mimic RLS filtering, you would simply replace the string literal in the [ACTIVE_USER] measure, as: ACTIVE_USER = USERPRINCIPALNAME().
Hi,
Thank you for the response. Generally I test the RLS in Power BI service using Test as Role feature and view as an actual user. But when I use Test as Role on the data set, I am not getting any option to see the behaviour of the other reports that use this data set using Power BI service live connection. I tried connecting as other test user and it works but I want to test it as a real user.
Appreciate your help!
Thank you. This is helpful!
I am logging in as actual user to test and also I added a table visual to the report that has the data model and testing the RLS for different roles using it.
Regards,
Keerthi
Hi,
I am wondering how did you achieve this. Can you please provide steps to get this working?
Thanks
Angad
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
45 | |
33 | |
29 | |
26 | |
24 |
User | Count |
---|---|
40 | |
33 | |
19 | |
18 | |
15 |