Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Import files from folder but when the creation date matches a data in a custom calendar

Hello,

I can import files from a folder and filter them based on its creation date etc. but I'd like to enhance it so that I filter out dates (dates are within the filename) that don't exist in a calender. I have a custom calendar in an excel file that defines bill cycle. 

 

Is there a way to filter the filenames when the date in the filename matches any value in my calendar file?

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

     

    Yes, you can extract the Date from filename first, then add another coloumn or you can use it within the same column to check with it is in the Calendar Date list. Make sure your date from filename has the same type/format with the Calendar Date. The CalendarDate here is my date list

    Table.AddColumn(#"Added Custom", "Custom", each List.Contains(CalendarDate,[DateinFile]))

     

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    Yes, you can extract the Date from filename first, then add another coloumn or you can use it within the same column to check with it is in the Calendar Date list. Make sure your date from filename has the same type/format with the Calendar Date. The CalendarDate here is my date list

    Table.AddColumn(#"Added Custom", "Custom", each List.Contains(CalendarDate,[DateinFile]))

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      yes I did exactly that but slightly modified

      if (List.Contains(BillingCalendar,[Date created])=true) then true else false

    • Anonymous's avatar
      Anonymous
      Not applicable

      Funny thing is when I do the same thing in Data Flow I get the following eror;

      Expression.Error: We cannot convert the value "[Binary]" to type Binary.