Convert SAP Product Hierarchy that has been broken by Excel `1010101` back into `01010101`
me@jaykilleen.com wrote this about 4 years ago and it was last updated over 3 years ago.
Given a table that has a column with an SAP product_hierarchy_id
.
This step below shows how to left pad that id based on its length.
PadProductHierarchy = Table.TransformColumns(#"Changed Type1",
{
{"product_hierarchy_id", each
if
_ <> "" and
_ <> null and
Text.Length(_) > 0 and
Number.IsOdd(Text.Length(_))
then
"0" & _
else
_,
type text
}
}
)