Forum Discussion

Poojajunnu's avatar
Poojajunnu
Frequent Visitor
9 months ago
Solved

custom message row level security in power bi.. How to implement it in power bi

custom message row level security in power bi.. How to implement it in power bi

  • 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!

  • 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()
    )

6 Replies

  • 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!

  • 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()
    )
  • 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 ๐ŸŒ€.

     

  • v-echaithra's avatar
    v-echaithra
    Community Support

    Hi Poojajunnu ,

    May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.

    Thank you.