Forum Discussion
Conditional Visibility of Objects
Good afternoon
Need to show and hide a graffiti in Power BI-visual based on a certain role,
Can we achieve it?
To my knowledge, conditional visibility is available in Power BI using slicers and bookmarks, but I don't need a click button or slicer, it should change automatically depending on the role selected.
Please share the solutions that are available with you to accomplish this.
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.
7 Replies
- DekuSuper User
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_AdminAdministrator
sorry but your answer is not understood
- v-saisrao-msftCommunity Support
Hi Syndicate_Admin ,
I wanted to check if you had the opportunity to review the information provided by Deku. Please feel free to contact us if you have any further questions. If there response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.- Syndicate_AdminAdministrator
I can't find the solution to my problem
- v-saisrao-msftCommunity Support
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.