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
Cookistador
Super User
Super User

Use UserName in a slicer (without RLS)

Hello everyone,

 

I'm facing an issue with the use of Username() or UserPrincipalName() in a report

I have to build a report to allow my ressources to track the projects on which they are assigned, I cannot used RLS due to the need of this ressources to see more details on other reports using the same dataset

 

If I use  the following measure:

ProjectRessource =  
IF(SELECTEDVALUE(Ressources[AuthorMail]) = USERPRINCIPALNAME(), 1,0)
 
It works in the case of a project with a single ressource, but as you know, generally you have more than one ressource in a project...
My datamodel (for this part) is pretty simple 
Cookistador_0-1722116084633.png

The ID in the ressources table, is the project ID, so my table ressource contains this kind of information

ID ProjectResourceMail
1ResourceA@microsoft.com
2ResourceA@microsoft.com
2ResourceB@microsoft.com
2ResourceC@microsoft.com
3ResourceB@microsoft.com
3ResourceC@microsoft.com
 
So with the measure I use, if my ressourceA is connected, he will only be able to see Project with the ID 1
 
Do you have any idea of how could I fix this issue?
 
Many thanks in advance for your help 🙂 
1 ACCEPTED SOLUTION
aduguid
Super User
Super User

Try this measure 

ProjectResourceVisibility = 
VAR CurrentUser = USERPRINCIPALNAME()
RETURN
IF(
    CALCULATE(
        COUNTROWS(Ressources),
        FILTER(Ressources, Ressources[ResourceMail] = CurrentUser)
    ) > 0,
    1,
    0
)

View solution in original post

1 REPLY 1
aduguid
Super User
Super User

Try this measure 

ProjectResourceVisibility = 
VAR CurrentUser = USERPRINCIPALNAME()
RETURN
IF(
    CALCULATE(
        COUNTROWS(Ressources),
        FILTER(Ressources, Ressources[ResourceMail] = CurrentUser)
    ) > 0,
    1,
    0
)

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.