Forum Discussion
PowerBI123456
5 years agoPost Partisan
Adding Leading Zeros in Power Query
How can I add leading zeros in Power Query only if a certain criteria is met. For example, I have a column where the number of digits can range from 10-13, but all of them need to be 13 digits. So if...
- 5 years ago
PowerBI123456 , then you reference a specific column in the formula
Table.AddColumn(#"Previous step", "Leading 0s", each Number.ToText([number column], Text.Repeat("0",13)))
CNENFRNL
5 years agoCommunity Champion
Hi, PowerBI123456 , you might want to follow this pattern to format all numbers,
Number.ToText(1234567890, Text.Repeat("0",13))
PowerBI123456
5 years agoPost Partisan
CNENFRNL Thanks, what if I want to refer to a specific column?
- CNENFRNL5 years agoCommunity Champion
PowerBI123456 , then you reference a specific column in the formula
Table.AddColumn(#"Previous step", "Leading 0s", each Number.ToText([number column], Text.Repeat("0",13)))- PowerBI1234565 years agoPost Partisan
CNENFRNL thank you!