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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

How to anonymize/mask part of Data

Hi every body,

 

I have a dat and I work with Power BI Desktop, and I want befor to start my analysis to anonymize(mask) the first name column and the last name column(and replace by a ID code).

Any ideas how to create unique masked customer names with Power BI?

Thank you.

 

Best regards,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

One way of preventing anonymised names from being merged in visualisations is to make sure they are not the same.


Add a calculated column:

Anonymised = "Airline " & RANKX('MyTable','MyTable'[CustomerName],,ASC,Dense)

Result:

Airline 1
Airline 2
Airline 3
...

If you prefer x's:

Add a Anonymised_Name table,

Name             Anonymised Name
"Air Holland"    "Air xxxxxxx"
"Air Hungary"    "Air xxxxxxx "
"Air Iceland"    "Air xxxxxxx  "

Use "fake space" (alt+0160 on the numpad) to prevent PowerBI from swallowing it up. Add a relationship and use this column in visualisations.

I prefer previous option as it makes it easier to distinguish and keep track of individual customers.


If you don't care whether number of "x"s matches real name:

Anonymised_Name_2 = "Air XXXXXXX" & REPT(" ", 
  RANKX('MyTable','MyTable'[CustomerName],,ASC,Dense))

(again fake space alt+0160)


Depending on what you do with your report, there is a significant risk of real customer names "leaking", so ideally you would want to anonymize your data before importing it.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

One way of preventing anonymised names from being merged in visualisations is to make sure they are not the same.


Add a calculated column:

Anonymised = "Airline " & RANKX('MyTable','MyTable'[CustomerName],,ASC,Dense)

Result:

Airline 1
Airline 2
Airline 3
...

If you prefer x's:

Add a Anonymised_Name table,

Name             Anonymised Name
"Air Holland"    "Air xxxxxxx"
"Air Hungary"    "Air xxxxxxx "
"Air Iceland"    "Air xxxxxxx  "

Use "fake space" (alt+0160 on the numpad) to prevent PowerBI from swallowing it up. Add a relationship and use this column in visualisations.

I prefer previous option as it makes it easier to distinguish and keep track of individual customers.


If you don't care whether number of "x"s matches real name:

Anonymised_Name_2 = "Air XXXXXXX" & REPT(" ", 
  RANKX('MyTable','MyTable'[CustomerName],,ASC,Dense))

(again fake space alt+0160)


Depending on what you do with your report, there is a significant risk of real customer names "leaking", so ideally you would want to anonymize your data before importing it.

Anonymous
Not applicable

Thank you Lewis.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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