Forum Discussion

syl-ade's avatar
syl-ade
Icon for Helper II rankHelper II
1 year ago
Solved

Conditional Display of Slicers Based on RLS in Power BI / Fabric

Hi All, Is it possible to conditionally show or hide a slicer based on the user’s RLS role or permissions? For example, a manager should see the slicer to choose an employee, while a regular emplo...
  • grazitti_sapna's avatar
    1 year ago

    Hi syl-ade,

    You can create a role mapping table like this,

    UserEmail Role
    manager@ company.com Manager
    [email protected] Employee
    [email protected] Employee

    And then to check user role create a measure like this 

     

    User Role =
    VAR _email = USERPRINCIPALNAME()
    RETURN
    LOOKUPVALUE(UserRole[Role], UserRole[UserEmail], _email)

     

    Now Create a measure to apply filter 
    Show Employee Slicer = IF([User Role] = "Manager", 1, 0)

     

    Create a card visual or transparent shape with custom message

     

    Add this on top of the employee slicer

    Use the Show Employee Slicer measure in the visual-level filter of that shape:

    Filter condition: Show Employee Slicer = 0

     

    🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
    💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
    🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
    🔗 Curious to explore more? [Discover here].
    Let’s keep building smarter solutions together!