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
Creature
Frequent Visitor

Extract text before delimiter in fabric using DAX.

Hey All,

 

I have a column that is ticket numbers like SCTASK0012345, WKR0012345 etc. I need to extract all the text before the numbers to create a column for "Ticket Type". This data set comes from SNOW - SQL SERVER - POWER BI - FABRIC. I cant edit it in the desktop version and upload so I need the DAX expressions to do this in fabric.

 

Update: The below works sort of but it now returns as WRK0,INC0 etc. I tried putting a K,C in place of 0 but Returned in error.

 

TicketType =
LEFT
     ('query1' [Number],
      Search(
        "0",
        'query1'[number],
      ))

Thanks!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Try something like below whether it suits your requirement.

It is for creating a calculated column.

 

TicketType =
LEFT ( query1[Number], SEARCH ( 0, query1[Number] ) - 1 )

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Sahir_Maharaj
Super User
Super User

Hello @Creature,

 

Can you please try this approach:

TicketType = 
VAR FirstDigitPosition = 
    MINX(
        FILTER(
            GENERATESERIES(1, LEN('query1'[Number])),
            MID('query1'[Number], [Value], 1) >= "0" && MID('query1'[Number], [Value], 1) <= "9"
        ),
        [Value]
    )
RETURN
    LEFT('query1'[Number], FirstDigitPosition - 1)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
Laxmanjatoth
Resolver I
Resolver I

Step 1 -- go to power query 
step-2 

Laxmanjatoth_0-1732019380453.png

step -3 in there a option is extract click on that.

Laxmanjatoth_1-1732019525811.png

 

step : 4 select  last characters 

Laxmanjatoth_2-1732020205315.png

step : 5  enter how many ending characters to keep .

Laxmanjatoth_3-1732020243974.png

 

let me know if you still help 


Best,
Laxman babu 

 

 

Jihwan_Kim
Super User
Super User

Hi,

Try something like below whether it suits your requirement.

It is for creating a calculated column.

 

TicketType =
LEFT ( query1[Number], SEARCH ( 0, query1[Number] ) - 1 )

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.