Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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 (in Power Query), in order to keep the size of the dataset as small as possible. I have been unable to determine how to filter to those two non-consecutive date ranges at the same time in Power Query.
The current filter applied is just getting all dates starting with the previous year's 13-week period until today:
#"Filtered Rows" = Table.SelectRows(#"Added Items", each Date.IsInPreviousNDays([Date], 475))
Instead of just everything from 475 days ago until today, I would like the past 100 days, and then also dates from 475 to 375 days ago. Any ideas?
Solved! Go to Solution.
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) ))
#"Filtered Rows" = Table.SelectRows(#"Added Items", each Date.IsInPreviousNDays([Date], 100) or Date.IsInPreviousNDays(Date.AddDays([Date],-375), 100))
#"Filtered Rows" = Table.SelectRows(#"Added Items", each Date.IsInPreviousNDays([Date], 100) or Date.IsInPreviousNDays(Date.AddDays([Date],-375), 100))
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) ))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
14 | |
13 | |
12 | |
12 | |
12 |