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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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