Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
pawlowski6132
Helper IV
Helper IV

Username() in Model

I've searched the internet for help but am coming up with nothing regarding this seeminly similar and likely, common business case: to filter a fact table based on the value of the Username() function.

 

The pieces I have are:

  1. Username() function
  2. Lookup table with User_ID and Cost Center
  3. Fact table with financial related columns including Cost Center

Simply, I'd like to:

 

  1. Understand who's authenticated by using the Username() function
  2. Match that against the Lookup table
  3. Filter the fact table based on the authorized Cost Centers that user can view

Thanx in advance.

 

jrp

3 REPLIES 3
pawlowski6132
Helper IV
Helper IV

Further, trying to avoid a RLS due to ongoing maintenance required to add, edit, delete user emails in dataset security.

 

thanx

 

jrp

Hi @pawlowski6132 ,

 

 

USERNAME() function helps to return the user domain login with the form of (Domain\User) in the locality or your local system.

Without a security configuration on your report you will see unique identifier for username which isn’t useful.

https://radacad.com/dynamic-row-level-security-with-power-bi-made-simple 

USERPRINCIPALNAME() function helps to return the user principal name with the form of (User’s login credential or xxxx@<tenant>onmicrosoft.com) in the Power BI Online Service.

You may try to use USERPRINCIPALNAME() function.

https://exceltown.com/en/tutorials/power-bi/powerbi-com-and-power-bi-desktop/dax-query-language-for-... 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yes, thanks, I am using USERPRINCIPALNAME(). 

 

I am still hoping someone can share scenario where they've used this function in a solution to filter data by user OUTSIDE the Dynamic RLS solution.

I've read both the articles in the link above and still, I don't want to use the DRLS solution because I don't want ANY maintenance or administration of users required in the DRLS solution. And frankly, I shouldn't have to.

 

If i have a lookup table that provides Users and Authorizations, and I can understand who is using my report, why would I be foreced to use DRLS solution??

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.