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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
ahamedafridi18
Frequent Visitor

How do i extract date from the source name which has string using power query

i have exported csv dat which has got date in their source name. it is a daily download report. i want to create a custom column which extracts the date from the source name so that i can cretae the date column for the dataset.image.png

3 REPLIES 3
Vijay_A_Verma
Super User
Super User

An alternative way in PQ is to use this in a custom column

Text.BetweenDelimiters([Source.Name]," ",".",{0,1})
ShrutikGumate
Microsoft Employee
Microsoft Employee

Hi @ahamedafridi18,

 

Here is a Dax query for a calculated column 'Date' to extract the date from the SourceName column and convert into date format

 

Date = FORMAT(DATEVALUE(RIGHT(LEFT([Source.Name],18),10)),"DD-MM-YYYY")
 
If you like my solution please consider giving a upvote..
 
Thank you!
 
 
m_dekorte
Super User
Super User

Hi @ahamedafridi18,

 

There are so many different ways to achieve that, just wondering how representative the image is...
For example any of these will do, just insert a Custom Column and copy an expression from below, replace "Source" with the column reference [Source.Name]

let
    Source = "Detroit 21-02-2024.xlsx",
    AlwaysBetween = Text.BetweenDelimiters(Source, " ", "."),
    AtTheEnd = List.Reverse( Text.SplitAny( Source, " .") ){1}?,
    Anywhere = List.First( List.Select( Text.SplitAny( Source, " ."), each Text.Length( Text.Select(_, {"-"}) )=2 ))
in
    Anywhere

 I hope this is helpful

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors