Forum Discussion

pwe5000's avatar
pwe5000
Frequent Visitor
3 years ago
Solved

Filtering to multiple date ranges at the same time

Hi, I am using data from Google Analytics, and I would like to get data for the past 13 weeks, and the same period in the previous year. I want to filter out the dates between those two periods (i...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Im not sure if it works the way you expect because of the way power query works with weeks but you could change that part.
    =Table.SelectRows(#"Inserted Year", each Date.IsInPreviousNWeeks([Date], 13) or ( [Date] < Date.AddDays(Date.From(DateTime.LocalNow()),-365) and [Date] > Date.AddDays(Date.From(DateTime.LocalNow()),-465) ))

  • wdx223_Daniel's avatar
    3 years ago
    #"Filtered Rows" = Table.SelectRows(#"Added Items", each Date.IsInPreviousNDays([Date], 100) or Date.IsInPreviousNDays(Date.AddDays([Date],-375), 100))