KNOWLEDGE BASE

## How to make some fields data anonymous using numbers or alphabet

Published: 23 Jan 2023

### Question

How to make some fields data anonymous using numbers or alphabet.
For example, you need to hide/anonymize a row of usernames that contain personal information.

### Environment

• Tableau Prep Builder 2020.1.3 or later

Option 1: Using Numbers
Calculate rank and use the rank value field instead of the original field. If you use RANK_DENSE function, no rank values are skipped so you will see consecutive rank values.
`{ORDERBY [Customer Name] ASC: RANK_DENSE()}`

Option 2: Using Alphabet
First, apply option 1. Then use the calculated field below. *[Option1] is the calculated field by Option 1.
```IF DIV([Option1],26) = 0 THEN CHAR([Option1]+64)
ELSEIF DIV([Option1],26) <27 THEN CHAR(DIV([Option1],26) +64) + CHAR([Option1] % 26 +65)
ELSE CHAR(DIV(DIV([Option1],26),26) +64) + CHAR(DIV([Option1],26) +64 -26) + CHAR([Option1] % 26 +65)
END```
RANK function cannot generate Alphabet but CHAR function can convert Alphabet from numbers.
The above formula can be used to convert numbers to up to 3 capital alphabetic characters (17576 patterns). If you need more patterns, add conditional expressions.