cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Dynamic data source based on date

Hi Team,

 

I have requirement like, from a folder of Excel files i have to pick the data file of MAX datekey files will be maintained in particular fashion i.e, Data Datekeyfiles will be maintained in particular fashion i.e, Data Datekey

As mentioned in the image file with max date key to be picked.

I believe it is possible by passing parameter to MQuery. 

Thanks in advance..

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Dynamic data source based on date

Hi @vedansh,

 

You can use query below to find the Excel file with the maximum date in Power BI desktop: 

 

 

let
    Source = Folder.Files("<folder path>"),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Name", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Name.1", "Name.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Name.1", type text}, {"Name.2", type text}}),   
    #"Changed Type1" = Table.TransformColumnTypes(Table.SplitColumn(#"Changed Type", "Name.2", Splitter.SplitTextByEachDelimiter({"."}, QuoteStyle.Csv, false), {"Name.2.1", "Name.2.2"}),{{"Name.2.1", Int64.Type}, {"Name.2.2", type text}}),
    MaxDte=List.Max(#"Changed Type1"[Name.2.1]),
    FilterRowWithMaxDate=Table.SelectRows(#"Changed Type1",each [Name.2.1]=MaxDte)
in
    FilterRowWithMaxDate

q3.PNGq4.PNG

 

Then you can click Binary to extract data from the Excel file. 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Dynamic data source based on date

Hi @vedansh,

 

You can use query below to find the Excel file with the maximum date in Power BI desktop: 

 

 

let
    Source = Folder.Files("<folder path>"),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Name", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Name.1", "Name.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Name.1", type text}, {"Name.2", type text}}),   
    #"Changed Type1" = Table.TransformColumnTypes(Table.SplitColumn(#"Changed Type", "Name.2", Splitter.SplitTextByEachDelimiter({"."}, QuoteStyle.Csv, false), {"Name.2.1", "Name.2.2"}),{{"Name.2.1", Int64.Type}, {"Name.2.2", type text}}),
    MaxDte=List.Max(#"Changed Type1"[Name.2.1]),
    FilterRowWithMaxDate=Table.SelectRows(#"Changed Type1",each [Name.2.1]=MaxDte)
in
    FilterRowWithMaxDate

q3.PNGq4.PNG

 

Then you can click Binary to extract data from the Excel file. 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Frequent Visitor

Re: Dynamic data source based on date

Hi @v-qiuyu-msft,

 

Great it worked, Thanks dear !!!!

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors