Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi. Newbie user of PowerQuery, so please excuse me is there is an obvious answer in the documentation, which I did not fully read before asking.
GS1-128 is a barcode encoding where the data are strings of characters prefixed with a 2-digit application identifier (AI), strings which are then concanated.
I got readings from a barcode scanners which are packed, i.e. the example from the wikipedia page would show as
00123456780000000001
2112345 1109010117100101
11090101171001012112345
(let's ignore for a moment 4-digit AIs, or the encoding of [FNC1] since I cannot write "character" GS on the board.)
I would like to transform those readings into a number of columns, one for each AI.
I believe it should be possible to extract several columns in M.
But what I am not easy with is to "consume" the input and how to "slice" it.
In traditional programming languages, it would use an index/pointer initialised to the begining of the string, a do{}until(end-of-string) loop and a select/case based on next two characters then advance pointer. But I do not know how to translate that logic into M...
Hi @antoineL ,
If all fields in the coumn have the same length and format, you can use split columns in power query directly, please refer:
If not, I think need to group them first which have the same length and format and then use split columns by number of characters.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @antoineL
Please show clearly the initial data and the expected result
Share it in text-tabular format so that the contents can be copied
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. Cheers |