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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors