Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
catheprado
Regular Visitor

How to count whitespaces in the beggining of a string?

Hello, i'm trying to count the number of white spaces in the beggining of a string in Power Query...

I couldn't find a solution yet.

 

Here's an example

catheprado_0-1613689611924.png

I have to count just the whitespaces before the text. 

 

Please, help me 🙂 

Tks

1 ACCEPTED SOLUTION
ziying35
Impactful Individual
Impactful Individual

Hi, @catheprado 

Try this:

= Table.AddColumn(<YourPreviousStepName>, "space_cnt", each Text.Length([<YourColumnName>])-Text.Length(Text.TrimStart([<YourColumnName>])))

View solution in original post

1 REPLY 1
ziying35
Impactful Individual
Impactful Individual

Hi, @catheprado 

Try this:

= Table.AddColumn(<YourPreviousStepName>, "space_cnt", each Text.Length([<YourColumnName>])-Text.Length(Text.TrimStart([<YourColumnName>])))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors