Forum Discussion
Previous 5 Week and Future 5 Weeks
Hi Experts
I am trying to work out based on Date column in Table A - which items have been delivered in the Previous 5 week and which items are due to be delivered in the next 5 week.
I have tried the following on Power Query
Date.IsInPreviousNWeeks([Date], 5) - This is not now giving correct results misses out week 48
and
Date.IsInNextNWeeks([Date], 5) - this is working
nor is the following working for previous 5 weeks
if Duration.Days(DateTime.Date(DateTime.LocalNow()) - [Date]) <= 30 then 1 else 0
pls try
[ t1 =Date.From( DateTime.LocalNow()), t2 = Date.StartOfWeek( t1), t3 = Date.EndOfWeek( t1), t4= Date.AddWeeks(t3,4), t5 = if [Date]>=t2 and [Date]<=t4 then true else false ][t5]
5 Replies
- AnonymousNot applicable
- Ahmedx
Super User
pls try this
you can change -4 to -5 and so on
[ t1 =Date.From( DateTime.LocalNow()), t2 = Date.StartOfWeek( t1), t3 = Date.EndOfWeek( t1), t4= Date.AddWeeks(t3,-4), t5 = if [Date]>=t4 and [Date]<=t3 then true else false ][t5]- AnonymousNot applicable
Thanks Ahmedx - much appericated. Works - How do i ament to future 5 weeks
- AnonymousNot applicable
from the sample data we should see an event for week 48 for the UK. This is not showing in the table for last 5 weeks