PDA

View Full Version : PQ - Add zero if there is a single digit after last delimiter (here: / )



sandy666
07-24-2020, 01:44 PM
Column1Result

Gi1/0/1Gi1/0/01

GI1/0/11GI1/0/11

abcdef5/8/5abcdef5/8/05

abcdef5/8/56abcdef5/8/56

ZXCV/bb/rtu/999/75ZXCV/bb/rtu/999/75

abc/879/134/444444abc/879/134/444444

ab/11/22/rem/3ab/11/22/rem/03

ab/11/22/rem/44ab/11/22/rem/44


let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content]
in Table.SelectColumns(Table.AddColumn(Source, "Result", each Text.Format("#{0}/#{1}",{Text.BeforeDelimiter([Column1], "/", {0, RelativePosition.FromEnd}),Text.PadStart(Text.Afte rDelimiter([Column1], "/", {0, RelativePosition.FromEnd}),2,"0")})),{"Result"})