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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.