Forum Discussion
Anonymous
6 years agoNot applicable
Add a Leading Zero within Column?
I have a column of data in which the lack of leading zero in the single digit numbers is causing plotting order issues. I would like to add a leading zero to each single digit number, what is the ea...
- Anonymous6 years ago
Hi Anonymous ,
Maybe not the tidiest solution, but if you always have the same string format:
Table.TransformColumns(Source, {{"Column_name", each Text.BeforeDelimiter(_, "Stage ") & "Stage " & Number.ToText(Number.FromText(Text.AfterDelimiter(_, "Stage ")), "0#"), type text}})Kind regards,
JB
Anonymous
6 years agoNot applicable
Hi Anonymous ,
Maybe not the tidiest solution, but if you always have the same string format:
Table.TransformColumns(Source, {{"Column_name", each Text.BeforeDelimiter(_, "Stage ") & "Stage " & Number.ToText(Number.FromText(Text.AfterDelimiter(_, "Stage ")), "0#"), type text}})
Kind regards,
JB
Anonymous
6 years agoNot applicable
The solution below is similar to your answer jborro. Text.PadStart might offer the clean that you are looking for.
= Table.AddColumn(#"Filtered Rows", "Custom", each Text.BeforeDelimiter([Column_name], "Stage ")
& "Stage " &
Text.PadStart(Text.AfterDelimiter([Column_name], "Stage "),2,"0"))
- Anonymous6 years agoNot applicable
Thank you. However I am getting this error, any ideas?
Expression.Error: The name 'Filtered Rows' wasn't recognized. Make sure it's spelled correctly.
- Anonymous6 years agoNot applicableHi Anonymous
Change it to the name of whatever step is preceding this one (e.g. Source).
Kind regards,
John