Forum Discussion
custom message row level security in power bi.. How to implement it in power bi
- 9 months ago
Hi Poojajunnu,
You can achieve this by following below steps:
Firstly check if the use has access to the report by checking user principle name with your table which has their email ids.
HasDataAccess =
IF(
ISFILTERED(SecurityUserMapping[UserEmail])
&& MAX(SecurityUserMapping[UserEmail]) = USERPRINCIPALNAME(),
1,
0
)Now create a measure AccessMessage =
IF (
[HasDataAccess] = 0,
"โ You are not authorized to view this data.",
BLANK()
)Now add this measure to a card visual and place on top of all visuals
and then turn off other visuals by adding HasDataAccess in filter pane by selecting 1 to show and 0 to hide.
๐ 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! - 9 months ago
Hii Poojajunnu
Power BI does not allow custom pop-ups or messages directly through RLS. When RLS blocks all rows, visuals simply show blank. The only workaround is to create a DAX measure that checks when the user has no data and display a card with a custom message (e.g., โYou do not have access to this dataโ). This is the only supported method to show a custom message with RLS.
RLS_Message = IF( ISFILTERED(YourTable[UserID]) && COUNTROWS(YourTable) = 0, "You do not have access to this data.", BLANK() ) - 9 months ago
Hi Poojajunnu ,
You can use ERRROR dax function to show error messages based on your RLS.
refer below link:
https://ocean-bi.com/2024/11/06/displaying-custom-error-messages-in-power-bi/
Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
Hi Poojajunnu,
Iโd like to contribute, so let me show you how I usually do it in my reports:
I combine these into a single field:
Labels - UserLogin =
var us = USERPRINCIPALNAME()
var n = RANDBETWEEN(1,25)
var icon = SWITCH(TRUE(),
n= 1, "๐ธ", n= 2, "๐", n= 3, "๐", n= 4, "๐ ", n= 5, "๐", n= 6, "๐", n= 7, "๐", n= 8, "๐ฝ",
n= 9, "๐", n= 10,"โข๏ธ", n= 11,"โ๏ธ", n= 12,"ยฉ๏ธ", n= 13,"๐", n= 14,"๐ฎ", n= 15,"๐ก", n= 16,"๐",
n= 17,"๐", n= 18,"๐ค", n= 19,"๐ง", n= 20,"๐ป", n= 21,"๐พ", n= 22,"๐ค","๐")
return
" Hello " & [NomeUsuarioLogado] &"! "& icon
This measure retrieves a name from another table when I have both the userโs name and email.
NomeUsuarioLogado =
var us = USERPRINCIPALNAME()
return
LOOKUPVALUE(dim_UserActiveDirectory[givenName],dim_UserActiveDirectory[mailuser],us,BLANK())
Of course, the use of icons may not be applicable. ๐
If this response was helpful in any way, Iโd gladly accept a ๐much like the joy of seeing a DAX measure work first time without needing another FILTER.
Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop ๐.