Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
FrankWe
Helper I
Helper I

How can I anonymise the names of employees in the visuals

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

1 ACCEPTED 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:

vcgaomsft_0-1702436813338.png

Other role:

vcgaomsft_1-1702437342934.png
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

View solution in original post

5 REPLIES 5
CheenuSing
Community Champion
Community Champion

Hi,

 

Please share some sample data of the tables in your current model.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

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:

vcgaomsft_0-1702436813338.png

Other role:

vcgaomsft_1-1702437342934.png
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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.