Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello all,
I have the following request and and I am wondering how to realize this.
Depending on a flag called "manager" in the "employee" table it is necessary to show or anonymise the names of the employees. If the flag "manager" is set for the logged in user all names should be visible normally. But if the flag is not set, only the name of the logged in user should be visible with the correct name. All other names must be anonymised showing only "******" or something else. This is necessary because the employees should not be able to directly compare themselves with other employees.
Is there a way to realize that in Power BI? 🤔
Many thanks in advance for your ideas.
Frank
Solved! Go to Solution.
Hi @FrankWe ,
Please try like:
Name =
VAR _managers = CALCULATETABLE(VALUES('Table'[EMailAddress]),FILTER(ALL('Table'),'Table'[Manager]="Y"))
VAR _result = IF(USERPRINCIPALNAME() IN _managers,SELECTEDVALUE('Table'[EmployeeName]),"******")
RETURN
_result
Manager role:
Other role:
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi,
Please share some sample data of the tables in your current model.
Cheers
CheenuSing
Hi,
the data structure for this problem is very simple. It is only one table containing all employees with several fields in it (see screenshot below).
_id | EmployeeName | EMailAddress | Manager |
1 | Employee 1 | Employee1@mycompany.com | N |
2 | Employee 2 | Employee2@mycompany.com | N |
3 | Employee 3 | Employee3@mycompany.com | Y |
4 | Employee 4 | Employee4@mycompany.com | N |
5 | Employee 5 | Employee5@mycompany.com | N |
In this Example on the "Employee 3" ( ID 3) must be allowed to see the EmployeeNames. All others (not having the flag "Manager" set to "Y" must only see an anonymised name like "*******" (as an example). I think the "EMailAddress" could be used to find the logged in user and depending on the value in column "Manager" the name must be shown (if flag is "Y") or the name must be anonymised (if flag is "N").
I hope that this is enough input for you.
Frank
Hi @FrankWe ,
Please try like:
Name =
VAR _managers = CALCULATETABLE(VALUES('Table'[EMailAddress]),FILTER(ALL('Table'),'Table'[Manager]="Y"))
VAR _result = IF(USERPRINCIPALNAME() IN _managers,SELECTEDVALUE('Table'[EmployeeName]),"******")
RETURN
_result
Manager role:
Other role:
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi,
Thank you for the idea. I will have a look if it is working for me. But a user who is not in the manager role should only see his own name but not all the other ones. For example if "Employee1" is the user then his name must appear in the "Name" column and all others must be "*****" for him.
Frank
Frank
I have tested it now. I created a measure with the logic you mentioned above and it is working. If I use a table visual I am able to add the measure as a column in this table.
But now the problem is, that I need this anonymous name in a Pie Chart for example. And there I cannot use the measure to show the anonymous names in this visual as this is not allowed.
Any idea how to do that?
Frank
User | Count |
---|---|
102 | |
92 | |
85 | |
78 | |
71 |
User | Count |
---|---|
113 | |
104 | |
101 | |
73 | |
65 |