Suppose you have product data with Product Code and Product Name columns. Now, you want to make the Product Codes always in 5 digits by filling zeros on the left. For example, you want “00001” for “1”. Here is how.
- Open the column header menu and choose “Create Calculation (Mutate)”
- Choose “Overwrite Existing Column”.
- Enter the following expression in the Calculation Editor.
str_pad(`Product Code`, pad="0", width=5)
Then, you have Product Codes in 5 digits by filling leading zeros.