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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
alfordtp
Frequent Visitor

Extract text until first number

I have a column that lists model numbers.  For example:

 

ABC24

XY34

QWERTY985

ID-25

 

As you can see, the number isnt always in the same spot, so its not as easy as saying grab the left 2 characters.  

 

In Excel I can create a formula that will extract from the left all the characters until it finds the first number.  That doesnt seem to work the same in Power BI.  Anyone know how to do this?

 

Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@alfordtp In Power BI click on Edit Queries and then click on "Add Column" Tab and click "Custom Column" and then type the query below. The [data] can be replaced with your column name. [<col name>]

 

=Text.Select([data],{"0".."9"})

 

 

or you could find the first occurance of a number using the following code(this is also custom column in power query editor)

 

=Text.PositionOfAny([data],{"0".."9"})

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@alfordtp In Power BI click on Edit Queries and then click on "Add Column" Tab and click "Custom Column" and then type the query below. The [data] can be replaced with your column name. [<col name>]

 

=Text.Select([data],{"0".."9"})

 

 

or you could find the first occurance of a number using the following code(this is also custom column in power query editor)

 

=Text.PositionOfAny([data],{"0".."9"})

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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