HI,
I HAVE A TABLE with text codes and I needed to add zero (0) at the beginning of codes that have less than 10 characters as in the example below.
I thought of using text.legth in the power query with IF but I couldn't, I appreciate the help.
In the final result I need to create a text code again
Solved! Go to Solution.
Hi @Spotto ,
You can use Dax:
Here are the steps you can follow:
1. Create calculated column.
After =
IF(
LEN('Table'[Before])<10,0&""&'Table'[Before],'Table'[Before])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Spotto ,
You can use Dax:
Here are the steps you can follow:
1. Create calculated column.
After =
IF(
LEN('Table'[Before])<10,0&""&'Table'[Before],'Table'[Before])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@Spotto , Try like this in power query
if Text.Length([Column]) <10 then "0" & [Column] else [Column]
User | Count |
---|---|
367 | |
101 | |
67 | |
57 | |
47 |
User | Count |
---|---|
325 | |
114 | |
84 | |
71 | |
60 |