Forum Discussion

Analyst001's avatar
Analyst001
Frequent Visitor
5 years ago
Solved

Hiding an entire column for specified users by RLS

Hello Friends, I need help on creating Row Level Security to hide the entire column. I tried creating roles in RLS but it is only filtering values.

Is there anything like column-level security in power BI?

 

Thank you in advance.

7 Replies

  • mmace1's avatar
    mmace1
    Impactful Individual

    Like you've noticed, Row Level Security only applies to Rows, not Columns. 

    Object-Level security as linked. 

    Or, you could copy the report, with that column not displayed- and give the users that shouldn't be able to see that colum, only access to that other report.   

  • The best work around I devised was to unpivot the column that you're trying to hide with another column that you don't care about. 

    This will effectively gives you two copies of each row in your data set. Then, you can create a new dynamic column, which contains (i) for the "urestricted user group", the value in the column and (ii) for the "restricted user group", an empty string or a word like "[Redacted]". This dynamic column would be created using an if statement.

    Then, all you have to do is assign two different row level security rules to your two user populations and select, based on the value of your dynamic column. This will change of the two parts of your data said they will see. Haven’t thought too much about it, but it is likely that this workaround could be extended or enhanced with little work.

     

    It probably has been said but userprincipalname() doesn't work for calculated columns.

     

    Again, you just have to make sure you pick your second parameter that you will use to pivot to be something you don't care about hiding.

  • The best work around I devised was to unpivot the column that you're trying to hide with another column that you don't care about. 

    This will effectively gives you two copies of each row in your data set. Then, you can create a new dynamic column, which contains (i) for the "urestricted user group", the value in the column and (ii) for the "restricted user group", an empty string or a word like "[Redacted]". This dynamic column would be created using an if statement.

    Then, all you have to do is assign two different row level security rules to your two user populations and select, based on the value of your dynamic column. This will change of the two parts of your data said they will see. Haven’t thought too much about it, but it is likely that this workaround could be extended or enhanced with little work.

     

    It probably has been said but userprincipalname() doesn't work for calculated columns.

     

    Again, you just have to make sure you pick your second parameter that you will use to pivot to be something you don't care about hiding.