Forum Discussion
Row Level security
- 9 years ago
Hi BradRose,
Within Power BI Desktop, username() will return a user in the format of DOMAIN\User and userprincipalname() will return a user in the format of [email protected].
Within the Power BI service, username() and userprincipalname() will both return the user's User Principal Name (UPN). This looks similar to an email address.
As Matt has mentioned above, username() will return a user in different format within Power BI Desktop and Power BI service. So could you try using the formula below to see if it works?
Login = SUBSTITUTE ( USERPRINCIPALNAME (), "@contoso.com", "" )
In addition, here is a good article about Dynamic RLS in Power BI for your reference. :smileyhappy:
Regards
What format is the LANID? Is it an email address or domain\username. Be careful as the behaviour on powerbi.com and power bi desktop is different.
- BradRose9 years agoHelper I
Matt:
LANID is a coulmn in our employee table is the just the username. In my measure I have stipped out the domain to match the column in the employee table.
Here is my measure
Login = SUBSTITUTE(USERNAME(),"NESTLE\","")
Brad
- v-ljerr-msft9 years agoMicrosoft Employee
Hi BradRose,
Within Power BI Desktop, username() will return a user in the format of DOMAIN\User and userprincipalname() will return a user in the format of [email protected].
Within the Power BI service, username() and userprincipalname() will both return the user's User Principal Name (UPN). This looks similar to an email address.
As Matt has mentioned above, username() will return a user in different format within Power BI Desktop and Power BI service. So could you try using the formula below to see if it works?
Login = SUBSTITUTE ( USERPRINCIPALNAME (), "@contoso.com", "" )
In addition, here is a good article about Dynamic RLS in Power BI for your reference. :smileyhappy:
Regards