Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Power Query - find split and remove

I have a column that contains text data. I want to perform some operations on it.

  1. Check if it has special characters, if so, then split and remove the leading zeros from the second part of the text and return the second part (without leading zeros).

  2. If no special characters, remove leading zeros and return the text

I did this in Excel using search and substitute functions but I want to perform the same operation in Power BI Power Query Editor.

enter image description here

like image 982
saran p Avatar asked May 31 '26 01:05

saran p


1 Answers

To remove leading zeros in text you can use the following custom column expression:

=Text.TrimStart([Column1], "0")

In the query editor under Transform > Split Column > By Delimiter you can split your column by a delimiter and a few extra settings. In your case you can do this a few times with the different delimiters. You can also choose which part you need and which you delte.

You also can combine both of the actions a few times.

like image 130
Strawberryshrub Avatar answered Jun 01 '26 21:06

Strawberryshrub



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!