Forum Discussion
Overlay notification/message (box and text) when access restricted page.
Hi NickzNickz_BI -
Create a User Table:
In your Power BI model, create a table that lists the users and their respective permissions.
Example table (UserPermissions):
User CanAccessTechnicalPage
[email protected] 0
[email protected] 1
This table assigns 1 for users who can access the Technical page and 0 for those who cannot.
Create a Measure to Show the Access Restriction Message:
Create a DAX measure to check the logged-in user and their permission to access the page.
Example DAX measure:
DAX
Copy code
AccessMessage =
VAR CurrentUser = USERPRINCIPALNAME()
VAR HasAccess = LOOKUPVALUE(UserPermissions[CanAccessTechnicalPage], UserPermissions[User], CurrentUser)
RETURN IF(HasAccess = 0, "You do not have access to this page, please contact the administrator.", "")
This measure checks if the current user has access to the Technical page. If not, it displays the custom message.
Add the Overlay for Restricted Users:
Go to Page2 (Technical Page) in Power BI, and add a Shape or Box that covers the entire page.
Set the transparency to 50% and choose a black background for the box.
On top of the box, add a Text Box for the restriction message, and link it to the AccessMessage measure created earlier.
Hide or Show the Overlay Based on User:
Use the Conditional Formatting feature to control the visibility of the overlay.
For example, you can create a card visual with the AccessMessage measure and apply conditional formatting to show the overlay only when the message is not blank.
Deploying in Power BI Service:
After creating your report, publish it to Power BI Service.
Ensure that Row-Level Security (RLS) is configured correctly to restrict access based on the user permissions set in the UserPermissions table.
Use USERPRINCIPALNAME() to check who is logged in and conditionally control access to the page without using buttons or hiding the page.
Hi rajendraongole1 ,
Result unsuccesfully or you can provide me any pbix file so that i can compare with mine... 😂 ....
Regards,
NickzNickz