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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Extracting a number from Text

Hi everyone :), I have a column with texts such as " XXXX P10000 FFFFF" , "ABCD R150000" would you please help me to find a formula to extract the 10000 and 150000 after the P and R. They are always either P or R as the begining. Thanks alot.
2 REPLIES 2
nandukrishnavs
Community Champion
Community Champion

@Anonymous 

 

The best option is to work on Edit Query.

Replace your letter P, R into single delimiter. For example ","

Then you can split column using a custom delimiter. https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

 

Another option- using DAX calculated column

my.JPG

 

Val = 
var _p=FIND("P",'Table (2)'[Column],1,0)
var _r=FIND("R",'Table (2)'[Column],1,0)
var _s= IF(_p<>0,_p,_r)
var _blank=FIND(" ",'Table (2)'[Column],1,0)
var result= VALUE(LEFT(RIGHT('Table (2)'[Column],LEN('Table (2)'[Column])-_s),_blank))
return result

 



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
๐Ÿ™‚

 


Regards,
Nandu Krishna

mahoneypat
Microsoft Employee
Microsoft Employee

I agree that this is much easier to do in the Query Editor.  A robust way to extra numbers (or any desired characters) from a text string is to use Text.Select().  For example, you can add a column with a formula like this:

 

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

 

The curly brackets create a list of the numbers from 0 to 9.  Only those characters will be extracted.  You can add other lists of desired characters too.  Note that if you have two separate number strings within the text, this formula would put them together (may be good or bad for what you are trying to do).

 

If this works for you, please mark it as the solution.

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (25)