Forum Discussion
Hiding a column based on a user
Hi Anonymous,
For your requirement, I'd like to suggest you to use query parameter to dynamic control the displayed columns.
Steps:
1. Create query parameter to store user name.
2. Create mapping table with 'user name' and 'column name'
Sample:
User, Columns
abc, {"ColumnA","ColumnB"}
bc, {"ColumnA","ColumnB","ColumnC"}
Test, {"ColumnB"}3. Find out the specific table column names based on above user parameter, then use it as 'table name' parameter of Table.SelectColumns function.
Reference links:
Deep Dive into Query Parameters and Power BI Templates
BTW, I haven't found a way to pass 'username' to query editor, so it is impossible to create dynamic table based on username.
Regards,
Xiaoxin Sheng
- Anonymous8 years agoNot applicable
Thank you. I will try this and see what happens. Much appreciated.
- parry2k8 years ago
Super User
Anonymousyour solution is ok but if any of the field is used in report and is not available in data model based on user column selection, report will stop working, so I personally don;t think it is advisable to not to return the columns to the model , it is better to make multiple roles based on user and remove those columns.
Let me know if I missed something.
So solution is to create calculated column and remove value from the column, it will break any report.
- Anonymous8 years agoNot applicable
Thanks for this. While the formula works to put a dash, the problem is since we can't turn off underlying data they can still export the aggragate and see the salary information.
I'm so bummed out about this. :( :( :( :(