Forum Discussion
Data level security on Power BI
You need to add a column to your users table for their Office365 email account. Then do a lookup in the row level security based on that. USERPRINCIPALNAME() returns the current users login (email address). So the filter is on PM_CODE. LOOKUPVALUE() is looking for the PM_CODE of the USERPRINCIPALNAME and uses the EMAIL_ADDRESS as a cross reference. The result of this is filtering for PM_CODE = AKASH or whoever the logged in user is.
It would look like this:
That did not work. Let me elaborate the scenario.
I have two tables Project and Security. Project is a dimension table which is joined to many fact tables to get the revenue, forecast etc.
And Security tables holds who can see what. So Akash can see only Projects for PmCode=1234, similarly Ajay can see only Projects where PMCode=3234
I tried to add the following on the PMCode of Security table, but it is not restricting the data correctly.
[PMCode] = LOOKUPVALUE(
[PMCode],
[UserName], USERPRINCIPALNAME()
)