Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

Hiding columns or column value depending on user

Hi all.

 

Have anyone a solution for hiding columns (or blanking out values) in a table/matrix, depending on the logged in user?

 

For example if the underlying data contains a column UserID, The user with id UserID should see the value in column myColumn. Any other user would not see the column at all, or just seeing a blank value.

 

Regards, and thanks in advance.

// Michael

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I think you'd need to re-orient your data so that you have this value in rows instead.  Then you can filter out the rows.

     

    Is it possible to unpivot your data to do this?

  • v-sihou-msft's avatar
    v-sihou-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Anonymous

     

    In Power BI, we can only limit data access on row level. Anonymous is correct, you should unpivot your source table to make the each users' data on row level. Then we can define a role with row level filter like: [User]=USERNAME()

     

    See: Dynamic Row Level Security with Power BI Made Simple

     

    And you can put the [User] column into Column group within Matrix visual to make it appear like a "column".

     

    Regards,

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      Thanks for the answer. But in this case the data can consist of a tabular with a few millions rows, and some 40 columns, I don´t think pivoting it is a valid option then.  We also have Row Level Security for the rows already.

       

      I think I was a bit unclear earlier, so I will try to explain some more.

      Is there no option to change columnvalues (to blank in this case) in DAX depending on another columnvalue? I am thinking I could have a rolename in a column, and depending on what role the user have in this specific transaction, the user wants to se different columns.