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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Rai_BI
Helper IV
Helper IV

Get the filter applied in RLS and show it in the visual

Hey guys,

I created a dashboard in Power BI with some sales information. In this report I applied RLS security so that users only see information about themselves, that is, they can only see the sales they made so as not to see information from other users. In this dashboard I need to create a dynamic title that brings the user's name respecting the RLS applied, that is, if the user's name is "Jhon M. Stan" the title needs to be "Jhon M. Stan", as the filter applied to the RLS is "John M. Stan".

I tried using a SELECTEDVALUE in the table column where the seller's name is, but that didn't work, as the filter is in RLS and not in a data segmentation.

Please, would anyone know how to do this?

5 REPLIES 5
Anonymous
Not applicable

Hi @Rai_BI ,

In Power BI Desktop, username() and userprincipalname() function will return the domain\user, but in Power BI Service, userprincipalname() function will return the upn name.

I create a sample for you:

1. below is my test data

Table:

vbinbinyumsft_0-1703485233634.png

2. create a role

vbinbinyumsft_1-1703485260840.png

3. create a measure

Measure = USERPRINCIPALNAME()

4. add a table visual with Table fields and set the title text

vbinbinyumsft_2-1703485351468.png

5. result

vbinbinyumsft_4-1703485501047.png

 

vbinbinyumsft_3-1703485406832.png

 

 

 

 

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@Rai_BI 

If you could expalin this part of your question?

"I tried using a SELECTEDVALUE in the table column where the seller's name is, but that didn't work, as the filter is in RLS and not in a data segmentation."

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

I meant that the SELECTEDVALUE function does not work if there is no filter in the data slicer. As the filter is applied to RLS, the SELECTEDVALUE function is useless in this case.

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly but please try to write a measure like below and put it into the card visualization. And then publish it to the service. 
Each user will see his/her name on the report.

Show user name measure: = USERPRINCIPALNAME()

 

USERPRINCIPALNAME function (DAX) - DAX | Microsoft Learn


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

It's not working as expected. It's bringing the user name like the following example "SERVBUSINESS\USER" and that's not what I'm looking for.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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