Forum Discussion
Conditional Visibility of Objects
- 1 year ago
Hi Syndicate_Admin,
You can dynamically control the visibility of a visual (graffiti) in Power BI based on the user's role, without using slicers or bookmarks. This can be done through Row-Level Security (RLS) and a Measure-Based Visual Filter. Thank you Deku, for your insights.
- In Power BI, navigate to Model View, select Manage Roles, and create a new role (e.g., "Admin"). To filter data based on the logged-in user, use USERPRINCIPALNAME(). If you have a UserRoles table with [UserEmail] and [Role] columns, apply the RLS rule: [UserEmail] = USERPRINCIPALNAME()This ensures users see only the data relevant to their assigned role.
- Create a DAX measure to control the visibility of the graffiti visual:
ShowGraffiti = IF(SELECTEDVALUE(UserRoles[Role]) = "Admin", 1, 0)
- This measure returns 1 to display the visual if the user has the "Admin" role; otherwise, it returns 0, effectively hiding it.
- In Power BI, select the graffiti visual, then drag the ShowGraffiti measure into the Filters pane. Set the filter condition to Show items where ShowGraffiti = 1 to ensure the visual is displayed only for users with the appropriate role.
Please refer to the below link for your reference:
Solved: Hide and Show visuals based on condition - Microsoft Fabric Community
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
I can't find the solution to my problem
Hi Syndicate_Admin,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.