Forum Discussion
Data level security on Power BI
Hi All,
I have data as below .
When Akash logs in, the dashboard should default to Pm Code = 1234, when Ajay logs in, it should default to Pm Code =3234
And it should not prompt user to select any value. Automatically it should apply data level secutiry based on whoever logs in. How do we achieve such feature in power BI.
Basically how do we capture who has logged in and then write a query to find what is the PM Code for his login should help.
13 Replies
- bsasPost Patron
- AnonymousNot applicable
Sure there is. You just need another column with the user's Microsoft username (usually their email address but it depends on your Office 365 setup). Then you enable row level security and set a filter there for UserTable[MSUsername] = USERNAME(). Publish the report, add all the users to this role on the service and you're all set.
- v-huizhn-msftMicrosoft Employee
Hi akj2784,
There is a blog that describes how to use Data level security in detailed steps, please review it.
https://datachant.com/2017/05/24/row-level-security-power-bi/
Best Regards,
Angelia- akj2784Post Partisan
Thanks. How do I know the user name/userid format accepted by Power BI. Name can be duplicate so I would like to drive it from User Id which is unique.
Lets say I have the data as show below in the roles table.
UserId PMCode
AKJAIN 1234
VJAIN 4321
AJAIN 3234
So I want to check the USERId of the person who logged in, then I would like to fetch its corresponding PM Code from this roles table. And then I would like to equate the transaction table with PM Code = the value fetched from above. So that the logged in user can see only relevant data.
So for above scenario, I would like to understand How I should create the Roles from Manager Roles feature in Power BI Desktop.
- AnonymousNot applicable
akj2784as I have already said, the username in Power BI is the Microsoft username, which generally takes the form of the user's email address in Office 365 but may be slightly different depending on your organization's specific setup. You need to add a column to this table with those usernames and use those.