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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
cristianj
Helper IV
Helper IV

find the first position in a string from a column

Hello , 

i need to find the position of the first number in a column 

Thank you i find this command but it gives me an error

SEARCH(\"[0-9]\", <string>)

thank you

2 ACCEPTED SOLUTIONS
PhilipTreacy
Super User
Super User

Hi @cristianj 

 

Download example PBIX file

 

You need to use Power Query and the Text.PositionOfAny function. 

 

Text.PositionOfAny - PowerQuery M | Microsoft Learn

 

Here's the query

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMkxMSlaK1YlWSkwyhDAqKquMYIKGiUZJxgj5FKPUNGOl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [String = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"String", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Pos of First Number", each Text.PositionOfAny([String], {"0".."9"}))
in
    #"Added Custom"

 

 

finum.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

Ahmedx
Super User
Super User

2 REPLIES 2
Ahmedx
Super User
Super User

pls txry this

Screen Capture #1291.png

PhilipTreacy
Super User
Super User

Hi @cristianj 

 

Download example PBIX file

 

You need to use Power Query and the Text.PositionOfAny function. 

 

Text.PositionOfAny - PowerQuery M | Microsoft Learn

 

Here's the query

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMkxMSlaK1YlWSkwyhDAqKquMYIKGiUZJxgj5FKPUNGOl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [String = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"String", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Pos of First Number", each Text.PositionOfAny([String], {"0".."9"}))
in
    #"Added Custom"

 

 

finum.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.