Našimi kurzy prošlo více než 10 000+ účastníků
2 392 ověřených referencí účastníků našich kurzů. Přesvědčte se sami
This is about the USERPRINCIPALNAME function, which shows the user name of currently logged user.
It is typically used for RLS authorization – thanks to it users only can see their own data (rows).
USERPRINCIPALNAME has no arguments, it is always like this:
This function can´t be written into a column – it only can be used as a measure or for role definition.
You should know, that this function provides different results in Power BI Desktop and in powerbi.com. In Desktop it provides the name of PC, in powerbi.com it provides the login (email) of currently logged user.
If you use it in measure and put it into a visual, you always know who is logged or the name of PC (on Power BI Desktop):
But use for RLS is much more interesting. Lets say there is this table containing sales data:
In this table, every account manager should only see his items.
Lets create a role:
Then, in portal, assign it to everybody who we will share this report with.
From now, everyone sees his own items – since for different persons the PRINCIPALUSERNAME functions provides different results.
It can´t be tested on desktop – because on desktop the USERPRINCIPALNAME can´t provide the users login.
Comments are closed.
2 392 ověřených referencí účastníků našich kurzů. Přesvědčte se sami
Pište kdykoliv. Odpovíme do 24h
© exceltown.com / 2006 - 2023 Vyrobilo studio bARTvisions s.r.o.
Is there a way to write logged in user’s name into a column?
Hello,
My USERNAME() and USERPRINCIPALNAME() are always blank in PBI Desktop and on powerbi.com, is there something more to know ?
Thanks! This is helpful.
Hi,
Is there a way to see which Role is being used too via Dax