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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
ABC11
Resolver I
Resolver I

Extract Date from Text in Column

Hello,

In power Query- I would like to extract date from Source.Name column  in Lasest date column.

Please help me here

 

Source.NameLastest Date
HZN All Last 7 - AM - 10-27-2024 05_31 AM10/27/2024
HZN All Last 7 - AM - 10-28-2024 05_31 AM10/28/2024
HZN All Last 7 - AM - 10-29-2024 05_31 AM10/29/2024
HZN All Last 7 - AM - 10-30-2024 05_31 AM10/30/2024
HZN All Last 7 - AM - 10-31-2024 05_31 AM10/31/2024
HZN All Last 7 - AM-2024-11-1211/12/2024
HZN All Last 7 - AM-2024-11-1311/13/2024
HZN All Last 7 - AM-2024-11-1411/14/2024
HZN All Last 7 - AM-2024-11-1511/15/2024
HZN All Last 7 - AM-2024-11-1611/16/2024
HZN All Last 7 - AM-2024-11-1711/17/2024
HZN All Last 7 - AM-2024-11-1811/18/2024
HZN All Last 7 - AM-2024-11-1911/19/2024

Thanks

ABC11

1 ACCEPTED SOLUTION

Hello Omid_Motamedise,

It working but when I click Table. All other column disappear. what would be the solution?

Please

Thanks

 

View solution in original post

5 REPLIES 5
ThxAlot
Super User
Super User

Easy enough,

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("lcoxDoAgDEDRqzTMNmkLCIxuDuoBJMS4s+n9I/EAVpY//LyczbxvMNUKy3ndEABhWluYUAIKiQPyh+V2TRm+dOzSqUdb6tL8T78KmZFFJ1YnTideJ6NOgk6iTpIp5QE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Source.Name = _t]),
    #"Extracted Date" = Table.AddColumn(Source, "Date", each Date.From(Text.BetweenDelimiters([Source.Name],"-"," ",1,1)))
in
    #"Extracted Date"

ThxAlot_0-1732261897322.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Omid_Motamedise
Super User
Super User

Hi @ABC11 

 

Check this solution

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("lcoxDoAgDEDRqzTMNmkLCIxuDuoBJMS4s+n9I/EAVpY//LyczbxvMNUKy3ndEABhWluYUAIKiQPyh+V2TRm+dOzSqUdb6tL8T78KmZFFJ1YnTideJ6NOgk6iTpIp5QE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ource.Name = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each List.RemoveNulls(List.Transform(Text.Split([ource.Name]," "), (x)=> try Date.From(Text.Replace(x,"AM-","")) otherwise null)){0})
in
    #"Added Custom"

If my answer helped solve your issue, please consider marking it as the accepted solution.

Hello Omid_Motamedise,

It working but when I click Table. All other column disappear. what would be the solution?

Please

Thanks

 

ABC11
Resolver I
Resolver I

Hello Greg,

Its didn't worked becuase it remove my whole data set.

I have really big data set with 48 column and thousands of row- all those data disappear.

Thanks

Please

Greg_Deckler
Community Champion
Community Champion

@ABC11 Here is one way:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jdI7CsMwDIDhqwjPMdbDju0xW4a0B2gIpXu29v40KSpZjNGiQXz/JK2rmx93mPYdltf7Axk8TLdjEHrOnpEjYHoKHVs3OMLAOZxbtw29tDTTYklrM62GVLCVClpSaqbUTX+JJ/LEp6dAbPSiXow+qo9Gn9Qnox/Vj0af1fd/4fJFff8BLl/V/6++fQE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Source.Name = _t, #"Lastest Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Source.Name", type text}, {"Lastest Date", type date}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Source.Name", Splitter.SplitTextByDelimiter("AM - ", QuoteStyle.Csv), {"Source.Name.1", "Source.Name.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Source.Name.1", type text}, {"Source.Name.2", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type1", "Source.Name.1", Splitter.SplitTextByDelimiter("AM-", QuoteStyle.Csv), {"Source.Name.1.1", "Source.Name.1.2"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Source.Name.1.1", type text}, {"Source.Name.1.2", type date}}),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Changed Type2", "Source.Name.2", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, false), {"Source.Name.2.1", "Source.Name.2.2"}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Split Column by Delimiter2",{{"Source.Name.2.1", type date}, {"Source.Name.2.2", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type3",{"Lastest Date"}),
    #"Added Custom" = Table.AddColumn(#"Removed Columns", "Latest Date", each if [Source.Name.2.1] = null then [Source.Name.1.2] else [Source.Name.2.1]),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom",{"Source.Name.1.2", "Source.Name.2.1", "Source.Name.2.2"})
in
    #"Removed Columns1"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

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.