Power Query – How to extract data before and after delimiters
I had a requirement where I wanted to extract the data before and after the data as shown below.
In order to do this, I created the following Custom Column with the syntax below.
I did try and use the “Columns from Examples” but it did not work, because in my actual dataset some columns did not have the “(Data)”
- I clicked on Custom Column
I then put in the Syntax below
Text.Trim(Text.BeforeDelimiter([Source Data],"(") ) & Text.AfterDelimiter([Source Data],")")
- NOTE: The reason for the first Text.Trim is so that my data would be returned without too many spaces
And here is my required output below.
I hope that you found this useful and if you got any questions please let me know.
Thanks for reading!