Forum Discussion

Sophie__'s avatar
Sophie__
Helper I
1 year ago
Solved

Anonymize a column user name by RLS

Hello, how can I anonymize a user column by '***' using RLS management? Regards, Sophie
  • v-echaithra's avatar
    1 year ago

    Hi Sophie__ ,

    Here is a workaround you can try to mask user-specific column data, you need to use a DAX measure.

    Create a security table that maps usernames to their allowed visibility.
    Link SecurityTable[Username] to your Users table on username.


    Apply a standard RLS filter on SecurityTable, such as:
    [Username] = USERPRINCIPALNAME()

    Create this measure Masked User Display:
    Masked User Display =
    VAR CanSee =
    LOOKUPVALUE(
    SecurityTable[CanSeeNames],
    SecurityTable[Username],
    USERPRINCIPALNAME()
    )
    RETURN
    IF(CanSee = TRUE(), SELECTEDVALUE(Users[UserName]), "***")


    Use this measure in your visuals, not the original UserName column.

    Hope this helps to resolve your issue.
    Best Regards,
    Chaithra E.