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.
You could use a measure to show a SVG. Then check if the user is listed in a table to toggle visibility
SVG=
If(
USERPRINCPALNAME() in seeSVG[email],
"..."
)
Need more information about what you are trying too do
- Syndicate_Admin1 year agoAdministrator
sorry but your answer is not understood