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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
idage
Helper I
Helper I

DATE FROM A TEXT STRING

Goodmorning community,

i need to solve a problem. I have a column containing for ex:

 

03-Jul-23 A

08-Nov-23*

03/11/2023

03/11/2023 A

03-Jul-23

and i need to extract date all in the same format.

Could you help me?

 

Thank you very much in advance.

 

5 REPLIES 5
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Use this formula in a custom column where [Dates] is the column name

Text.Start([Dates], 6) & Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)) (Text.Middle([Dates], 6, Text.Length([Dates]))){0}

Sample code for testing

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDW9SrN0TUyVnBUitUB8i10/fLLgHwtCNdY39BQ38jAyBiNC1MO0w7mGZpAeVFKsbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Dates = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Extracted Dates", each Text.Start([Dates], 6) & Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)) (Text.Middle([Dates], 6, Text.Length([Dates]))){0})
in
    #"Added Custom"

Thank you very much for your help .

It generally works but it give me Error when it find cells containin NULL or date in this format:

 

03/11/2023

idage_0-1692952803409.png

 

idage_1-1692952876153.png

 

Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Use this in a custom column

try [a=Text.From([Dates]), b=Text.Start(a, 6) & Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)) (Text.Middle(a, 6, Text.Length(a))){0}][b] otherwise null

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

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.