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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
liberty20
Frequent Visitor

Get data from different files on the basis of date created

Hi experts,

I have 2 files - File1 & File2

While importing files in power bi, I need File1 should be selected when [Date created] is before 17-09-2022 03:45:59 else File2 should be selected.

 

Thank you in advance!

1 ACCEPTED SOLUTION

 

You're nearly there. Just put the file names as a second condition in a boolean filter:

= Table.SelectRows(
    Source,
    each ( [Date created] < #date(2022, 09, 17) and Text.StartsWith([Name], "File1_") )
        or ( [Date created] >= #date(2022, 09, 17) and Text.StartsWith([Name], "File2_") )
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
BA_Pete
Super User
Super User

Hi @liberty20 ,

 

Use a folder connector to connect to the folder(s) the files are in.

You should get a view something like this where you can filter using file metadata before expanding the [Content] column to append all filtered files:

BA_Pete_0-1674665750330.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Thank you for a quick response!
I am using sharepoint folder as a source and both the files are present in same folder.

I need both the files in my data but one file is having historic data(before 17-09-2022) +current data(after 17-09-2022) and second file is having current data only (after 17-09-2022).

 

Expected result should be :
= Table.SelectRows(Source, If [Date created] is before 17-09-2022 then each Text.StartsWith([Name], "File1_") else Text.StartsWith([Name],"File2_))

 

As per your suggestion, if I will apply filter on files then I will get both the files and data after the date 17-09-2022 will get duplicated as both the files are having data for that dates.

 

You're nearly there. Just put the file names as a second condition in a boolean filter:

= Table.SelectRows(
    Source,
    each ( [Date created] < #date(2022, 09, 17) and Text.StartsWith([Name], "File1_") )
        or ( [Date created] >= #date(2022, 09, 17) and Text.StartsWith([Name], "File2_") )
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors