Forum Discussion
Extract every string occurrence with additional characters
- 2 years ago
I suggest:
in the Advanced Editor:
#"Added Custom" = Table.AddColumn(Source, "Extract", each Text.Combine( List.Accumulate( Text.PositionOf([Column1], "AD", Occurrence.All), {}, (s,c)=> s & {Text.Middle([Column1],c,6)}),", "), type text)or in the UI:
Text.Combine( List.Accumulate( Text.PositionOf([Column1], "AD", Occurrence.All), {}, (s,c)=> s & {Text.Middle([Column1],c,6)}), ", ")
Why not just use this in your Table.AddColumn:
each Text.Combine({Text.Range([Column1], 0, 6), Text.Range([Column1], 8, 6)}, ", ")
Simpler, plus what if it's ever something besides "AD"?
--Nate
- BizyB2 years agoRegular Visitor
thanks Anonymous and apologies for coming back to you late on this.
the trouble with the Column1 data is that it is manually documented by hundreds of users with just a guideline and no control. So the position of "AD" is not static. Also the delimiter is not constant as well because of the varying user inputs.
Because of the above conditions, think the solution from ronrsnfld works better. Also currently we are just focused on getting AD. Anything besides "AD" that comes in later will have to be dealt with it accordingly later on.. so not worries about it now 🙂
thank you!