Forum Discussion
Leading Zero
- 10 years ago
If your source data has leading zeros, then you need to solve this when you import the data (assuming you are not connecting directly to the data source), by making sure you format the column as text in the query editor. Otherwise, you will need to create a calculated column that pads the store IDs with the correct number of leading zeros.
If the column (Col) you wish to add zeros isformated as whole numbers, try using this:
FORMAT(Table[Col],"000")
This would make your entire column in three digit format.
Hope this helps!
- jdourley8 years agoFrequent Visitor
Can you break this down further for a new user? I tried creating a custom column and I entered FORMAT([COLUMN], "0000"). I know I am wrong, but any pointers to understanding why or the basics would be greatly appreciated.
- jdourley8 years agoFrequent Visitor
Can you break this down further for a new user? I tried creating a custom column and I entered FORMAT([COLUMN], "0000"). I know I am wrong, but any pointers to understanding why or the basics would be greatly appreciated.
- SJ8 years agoHelper I
In the import stage M Query if you add a new column - you can use this formula:
If it is a number you are trying to convert do this:
Text.PadStart(Text.From([Column]),5,"0"))
The "Text.From([Column])" is needed only to change the format from number to text as numbers cannot be formatted into text.
If it is in Text format already do this:
Text.PadStart([Column],5,"0")
In the DAX report you can use the following:
FORMAT(['Column'),"000")
Hope this works for you.
Soren