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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Possible to filter data based on the user who is logged in?

I have created a report based on an entity in the Common Data Service.  One of the fields in my entity is called username.  I want to be able to filter the data so users who view the report will only see their own data.  Is this possible?  If so, how?

 

I tried using Row Level Security to implement this, but it did not work.

6 REPLIES 6
LivioLanzo
Solution Sage
Solution Sage

it is possible by using Row Level Security, you need to add an additional column listing the email address with which they will log into Power BI service and then use the function USERPRINCIPALNAME

 

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

 

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Anonymous
Not applicable

@LivioLanzo,

 

Thank you for your reply.  Is it possible to use USERNAME() rather than USERPRINCIPALNAME()?  In the article, it mentions that it is possible.  I tried creating a user security role with the following DAX expression:  [Username] = USERNAME()

This did not work.

 

I do not have a column in my entity for email addresses, so USERPRINCIPALNAME will not work for me.

https://www.youtube.com/watch?time_continue=5&v=qrlq9sZyjug

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Anonymous
Not applicable

@LivioLanzo,

 

I watched the video but it still does not answer my question.  I'm aware I can create roles where [field] = "Text".  However, I want to be able to create a role based on who is logged in.  An expression like [Username] = USERNAME() doesn't seem to work.  Is there something wrong with my formula?

You need to add an additional column to your table containing the email address they will use to log into Power BI service, that is what is recognized in the service. USERNAME and USERPRINCIPALNAME both return the email address of the user when used in the Service

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Anonymous
Not applicable

@LivioLanzo,

 

I added a field called cr265_useremail and populated it with users' email addresses.  I then created a security role with the DAX expression: [cr265_useremail] = USERPRINCIPALNAME()

 

I then clicked "View as roles".  This did not work.  I also tried [cr265_useremail] = USERNAME().

 

Am I missing something?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.