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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
breben
Microsoft Employee
Microsoft Employee

Resolve issue with username data for RLS

Trying to implement RLS for a report.  The user name data in the data set is only "Firstname Lastname".  Using USERNAME() won't help as it returns the domain\logonname, which the logonname won't be the same data as First Last name.  Same for USERPRINCIPALNAME().  Do I need to create a mapping somewhere of each user's First and Last and tie it to their USERNAME or USERPRINCIPALNAME to make this work? Is there a better way?  thanks   

4 REPLIES 4
parry2k
Super User
Super User

@breben for the xls and it will pass it on to your connected table. You can check RLS-related videos on my channel just to get a basic understanding of where to apply the role



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

breben
Microsoft Employee
Microsoft Employee

I'm still struggling on the DAX portion.  The native UserName() and UserPrincipalName() functions won't work since my dataset only has the user's full name (Joe Smith) and neither username or UPN in this scenario contain the full name, only an abbreviation of their full name (jsmith1234@company.com).  I have an XLS where I have defined the user's full name and the related UPN and have created the relationship to the database dataset but still struggling on how to implement this lookup in the report. 

parry2k
Super User
Super User

@breben that is the way to crate the mapping table to make it work, or extract first name and last name from userprincipalname() if email and first, last name use the standard logic.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

breben
Microsoft Employee
Microsoft Employee

OK that's what I figured.  So from the database datasource, the user name is "Joe Smith".  I have created an .XLS for now with two columns, one for the full name and the other for the UPN.  So, "Joe Smith" in the first column and jsmith1234@company.com in the second column. 

 

In PBI I created the relationship between the database and the .XMS, with the full name as the linked field.

 

Now when I create the role in PBI, am I creating the rule for the database source table which has the full name, or am I creating the rule for the .XLS, which is where the mapping data is held?  That's where I am currently confused.     

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors