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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Extract date and specific string from text

Hi
I have the following table that contains everything in one cell!!!

I want to extract the fist & last date entered in that cell and first & last size in the formate of (00/64").
That 4 columns should be added to the original table similar to pic below.

I want to do it using PQ.

Extract date.JPG

4 REPLIES 4
AlienSx
Super User
Super User

Hi, @Anonymous 

let
    Source = your_table,
    delim = {" on ", ". ", ", ", " "},
    col =     
        Table.AddColumn(
            Source, "rec", 
            each 
                [a = 
                    List.Buffer(
                        List.Skip(
                            Splitter.SplitTextByAnyDelimiter(
                                delim, 
                                QuoteStyle.None
                            )([Remark])
                        )
                    ),
                b = 
                    [First Size = a{0}?,
                    First Date = a{1}?,
                    Last Size = a{List.Count(a) - 2}?,
                    Last Date = List.Last(a)]][b]
        ),
    expand = Table.ExpandRecordColumn(col, "rec", {"First Size", "First Date", "Last Size", "Last Date"})
in
    expand
ronrsnfld
Super User
Super User

You can extract the components using Regular Expressions. You can implement Regular Expressions using a Custom Function or, if you are running Power Query in Power BI, you can also use Python or R.

Anonymous
Not applicable

You just need to use the Extract menu under the Add Columns tab, making sure you choose Text  store or Text After Delimiters, making sure the parameters include whether to start from the beginning or end of the string. 

--Nate

Anonymous
Not applicable

I tried a lot. I couldn't get a clue.

Maybe second eye can.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors