Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi Experts,
I have a users table in my dataset as below. (This table is disconnected)
I need to implement RLS, where users belongs only to the "HR" department must not see any data, whereas the rest of users have to see all the data in the report.
Summary:
User3 and User5 - Data restricted as whole
Remaining Users - Access to All data.
How can we create DAX under role to achieve this.
Pls advice
Solved! Go to Solution.
Hi @selvaskm ,
First of all, thanks @NaveenGandhi for the quick reply. Allow me to provide additional insights:
You can use the following DAX:
COUNTROWS(FILTER('user_table',[username]==USERPRINCIPALNAME() && [department] <>"HR"))>0
Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @selvaskm ,
First of all, thanks @NaveenGandhi for the quick reply. Allow me to provide additional insights:
You can use the following DAX:
COUNTROWS(FILTER('user_table',[username]==USERPRINCIPALNAME() && [department] <>"HR"))>0
Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @NaveenGandhi
Thanks for reply.
In my dataset relationship is not there between user_table and fact_table.
As we need to see "Full data" or "No data" for certain users.
VAR loggeduser = MAXX(FILTER( UsersTable, UsersTable[username] = USERPRINCIPLENAME() ), UsersTable[Department])
RETURN
IF(loggeduser <> "HR", TRUE(), FALSE()
)
it gives expected results when as user is belongs to HR alone (1 record only in usertable),
but if a user have more departments then it will take maximum value.
In that case we may have incorrect access
Hi @selvaskm
https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security
You definetly need a relationship between the secuirty table and you main table. Once you have a relationship follow the above first 8 steps in "Define roles and rules in Power BI Desktop
" section. But in the 6th step use below DAX
If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
34 | |
30 | |
18 | |
12 | |
8 |
User | Count |
---|---|
50 | |
35 | |
30 | |
14 | |
12 |