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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
klikk680
Frequent Visitor

Unique anonymize customer names in two different table with Relationship

I would need to mask the customer identify, it is fiscal code.  This information is presents in two different tables.

The fiscal code field is also the key to relating the tables so, the new field anonymized must maintain the relationship between the tables.

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

Thank you.

6 REPLIES 6
Anonymous
Not applicable

Hi @klikk680 ,

 

My sample data is this.

Table1

NameSales

Paul1
Bob2
Tom3
James4
Jimmy5

 

Table2

NameDate

Paul1/1/2020
Bob2/2/2020
Tom3/3/2020
James4/4/2020
Jimmy5/5/2020
Jimmy6/6/2020

 

The way to keep anonymous names in the original relationship between the two tables is to ensure that they are not the same.

 

You could create a calculated column both in Table1 and Table2.

 

Anonymised = "Name " & RANKX('Table1',[Name],,ASC,Dense)
Anonymised = "Name " & RANKX('Table2',[Name],,ASC,Dense)

 

2.png3.png

1.png

 

Or you could use spaces to distinguish.

 

Name     Anonymised Name
"Bob"    "Name xxxxxxx"
"James"  "Nmae xxxxxxx "
"Jimmy"  "Name xxxxxxx   "
Anonymised 2 = "Name XXXXXXX" & REPT(" ", RANKX('Table1',[Name],,ASC,Dense))
Anonymised2 = "Name XXXXXXX" & REPT(" ", RANKX('Table2',[Name],,ASC,Dense))

 

4.png6.png

Even if the Name column is not used as the relationship, the anonymous column can still maintain the original relationship.

5.png

8.png

 

You can check more details from here.

 

Reference:How to anonymize/mask part of Data

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

You can 

hi

I tried but it doesn't work ... maybe I'm wrong?

fig1_ko.JPG

 

 

 

 

https://drive.google.com/drive/folders/1J2sPjdt5IpHDis12Vq-KmznPMbTakSbZ?usp=sharing 

 

amitchandak
Super User
Super User

Greg_Deckler
Community Champion
Community Champion

@klikk680 - Would need to see sample data but maybe: https://community.powerbi.com/t5/Quick-Measures-Gallery/Anonymous-Too/m-p/1106722#M533



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

hi @Greg_Deckler 

this solution could be fine but "Anonymous Column" is to long 🤔

After your idea the result is:

Table1 Table2
CFCostAnonymous CF by Anonymous Too Column CFdocAnonymous CF by Anonymous Too Column
aaasss21x10y222h250979711511511550509750494912048121104 aaasss21x10y222ha2150979711511511550509750494912048121104
pppddd12e55u999r2110149112112112100100100505353117575757114 yyyccc12e55u999ra3210149121121121999999505353117575757114
0000000000212365148504948484848485048484848535154 0000000000212365a1148504948484848485048484848535154
1234567890123456251504949485353575051545452525556 1234567890123456a6551504949485353575051545452525556
0000000000000002348484848484848485048484848484848 0000000000000009a3348484848484848484848484848484857
2000000000000000548484848484848485048484848484848 2000000000000010a6848494848484848485048484848484848
pppddd12e55u999r510149112112112100100100505353117575757114    
1234567890123456951504949485353575051545452525556    

 

I will say something more about the field to be anonymized: the CF field is a combination of numbers and letters or it can be just numbers, its length is 16 characters and some values ​​may be missing.

Is there any way to get a anonymous value of 16 characters or less ?

Thanks,

 

@klikk680 - Well you could use LEFT([Anonymous],16) but can't guarantee that would be unique. I'll try to think of something else but it is the unique part that is problematic I think.

 

Or turn off word wrap and shrink the column.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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