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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Extract number with condition

Hello,

 

I have this column :

 

DFS-PI1

DFS-PI2

01234

P393

BLABLABLA

 

And I want to create a column that extract the last number only if it starts with "DFS-PI", otherwise show null. The result would be:

1

2

null

null

null

 

 

I can't find a way to do that. Anyone can help me please?

Thank you

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

In Power Query you would create a new column with the following calculation:

if
  Text.StartsWith([yourColumnName], "DFS-PI")
then
  Text.End([yourColumnName], 1)
else
  null

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

In Power Query you would create a new column with the following calculation:

if
  Text.StartsWith([yourColumnName], "DFS-PI")
then
  Text.End([yourColumnName], 1)
else
  null

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




jppv20
Solution Sage
Solution Sage

Hi @Anonymous 

 

This should work:

Extract = IF(LEFT('Table'[Column],6)="DFS-PI",RIGHT('Table'[Column],1),BLANK())
 
Jori

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI 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.