Forum Discussion

Yash_'s avatar
Yash_
Regular Visitor
4 years ago
Solved

Power BI Slicer default value as per UserPrincipalName

I'm trying to create a slicer which will contain the names of the users. The table which contains usernames also have a column email_id, which will contain userprincipalname of the user. How can I create a condition so that by default the user should see their own data, and they should be able to see other user's data if they want? 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Yash_ ,

     

    Create a measure like below:

    Measure = IF(SELECTEDVALUE('Table'[email_id])=USERPRINCIPALNAME(),1,0)
    Then add this measure to visual filter and set value = 1.
    After that the visual will only show the data that matched the user and users could see all data if they clear the filter.
     
    Best Regards,
    Jay

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Yash_ ,

     

    Create a measure like below:

    Measure = IF(SELECTEDVALUE('Table'[email_id])=USERPRINCIPALNAME(),1,0)
    Then add this measure to visual filter and set value = 1.
    After that the visual will only show the data that matched the user and users could see all data if they clear the filter.
     
    Best Regards,
    Jay
    • Nivedhana's avatar
      Nivedhana
      Icon for Helper I rankHelper I

      Very helpful! Is there a way we can select this slicer value by default?

  • Yash_ , for that you need a column, but you can use UserPrincipalName in a measure only. So I doubt some option for that