Forum Discussion
medmbchr1989
Helper I
2 years agoExtract a specific text with DAX or in Custom Column in PowerQuery (vehicule registration number)
Hi I have a set of data from which I need to extract a registration number with the following structure: "[x]-a-[y]" knowing that: x and y are composed of a nonspecific number of digits a is a ...
- 2 years ago
you can try this in PQ
= Table.AddColumn(#"Changed Type", "Custom", each
[a=Text.Remove([Column1],{"-"," "}),
b=Text.PositionOfAny(a,{"0".."9"},2),
c=Text.Middle(a,List.Min(b),List.Max(b)+1),
d=Text.PositionOfAny(c,{"a".."z","A".."Z"}),
e=try Text.Insert(Text.Insert(c,d,"-"),d+2,"-") otherwise null
][e])pls see the attachment below
- 2 years ago
Easy enough,
= Table.AddColumn(#"Changed Type", "SN", each let start = Text.PositionOfAny([Text], {"0".."9"}, 0), end = Text.PositionOfAny([Text], {"0".."9"}, 1) in try Text.Replace(Text.Range([Text],start,end-start+1), " ", "-") otherwise "")
AmiraBedh
Super User
2 years agoI updated the answer
medmbchr1989
Helper I
2 years agoAnd replied accordingly with a remark (but it works for my case, but discovered something else ...)