Text.TrimStart Power Query

Text.TrimStart Power Query to remove leading zeros

Text.TrimStart power query function helps us to remove the leading zeros from the given string. It comes under the category of Power query text functions.

Syntax

Text.TrimStart(Given String, characters that you want to trim)

It takes two parameters.

  • The First parameter is the given string that is compulsory
  • The second parameter is the number of characters that you want to trim, and it is optional

Text.TrimStart power query function Example

Let’s take the following example in which we have some account numbers with leading zeros, and we want to remove them.

Accounts dataset

We will use the following formula to remove leading zeros from the text.

Text.TrimStart([Account],"0")

As you can see, it took two parameters.

  • The first parameter is the name of the column “Account.”
  • The second parameter is the character “0” we want to remove.
Text.TrimStart power query function
By applying the above Text.TrimStart function, we will get the following result.
Text.TrimStart power query function result

To learn more, please visit Learn DAX

Similar Posts