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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
modwonka
Helper I
Helper I

Extract date from parenthesis

Hello everyone,

 

first of all, thanks for your help.

 

I have one column with a long part of the text in each row from which I would like to extract a date.

 

This is one row: "TEXT_EXAMPLE1 (2021-06-25 15:00), TEXT_EXAMPLE2 (2021-06-25 16:00), TEXT_EXAMPLE3 (2021-06-25 15:20), TEXT_EXAMPLE4 (2021-06-25 15:25)"

 

How can I extract the date complete to create a new column from TEXT_EXAMPLE3? Which is the formula?

 

Thanks again for your time and help.

 

Cheers!

2 ACCEPTED SOLUTIONS
Jakinta
Solution Sage
Solution Sage

If your desired date/time is always inbetween 3rd pair of parenthesis, you can add step below...

= Table.AddColumn(PriorStepName, "Custom", each Text.BetweenDelimiters([TextColumnName], "(", ")", 2, 0))

 

If not you might do it relative to "TEXT_EXAMPLE3" position...

= Table.AddColumn(PriorStepName, "Custom", each let l=List.Transform( Text.Split([TextColumnName]," "), each Text.Remove(_,{"(",")",","})), i=List.PositionOf(l, "TEXT_EXAMPLE3") in l{i+1} & " " & l{i+2} )

 

View solution in original post

Hi  @modwonka ,

 

Previousstep refers to the previous applied step,not the column.

Take below steps as example:

vkellymsft_0-1630306996391.png

Now if you wanna create a new step,then "Added Custom" is the previous step.

Check my .pbix file attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my reply as a solution!

 

View solution in original post

4 REPLIES 4
Jakinta
Solution Sage
Solution Sage

If your desired date/time is always inbetween 3rd pair of parenthesis, you can add step below...

= Table.AddColumn(PriorStepName, "Custom", each Text.BetweenDelimiters([TextColumnName], "(", ")", 2, 0))

 

If not you might do it relative to "TEXT_EXAMPLE3" position...

= Table.AddColumn(PriorStepName, "Custom", each let l=List.Transform( Text.Split([TextColumnName]," "), each Text.Remove(_,{"(",")",","})), i=List.PositionOf(l, "TEXT_EXAMPLE3") in l{i+1} & " " & l{i+2} )

 

Hi Jakinta,

 

thanks so much for your answer. I tried your formula, it seems they work, but i have a new error that i don't know how to fix it. 

 

i understand i have to change "PriorStepName" with the real name of my column, isn't it? The name is: "Tags (created on)".

 

So, i have this formula:

= Table.AddColumn([#"Tags (created on)"], "Custom", each let l=List.Transform( Text.Split([TextColumnName]," "), each Text.Remove(_,{"(",")",","})), i=List.PositionOf(l, "TEXT_EXAMPLE3") in l{i+1} & " " & l{i+2} )

And then, i have this error: 

 

"Expression.Error: It can't convert the valor "TEXT_EXAMPLE1..." to Table type. 

Details: 
Value=TEXT_EXAMPLE1 (2021-06-25 15:00), TEXT_EXAMPLE2 (2021-06-25 16:00), TEXT_EXAMPLE3 (2021-06-25 15:20), TEXT_EXAMPLE4 (2021-06-25 15:25)

Type=[Type]

 

Do you know how can i fix this? 

thanks! 

 

 

Hi  @modwonka ,

 

Previousstep refers to the previous applied step,not the column.

Take below steps as example:

vkellymsft_0-1630306996391.png

Now if you wanna create a new step,then "Added Custom" is the previous step.

Check my .pbix file attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my reply as a solution!

 

Hi Kelly, 

 

thanks so much for your answer! It was really helpful. With your help and Jakinta I could do my task. 

 

Cheers! 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.