Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I have successfully used this expression to get the first day of last week last year:
=WeekStart(MakeWeekDate(year(today())-1,week(today()),0)-1)
but when using this expression today I get 2019-12-30 rather than 2020-01-06 because the week numbers differ 2020 vs 2021
any ideas on how to alter this formula to get it right?
Running QlikView 11.20 SR 18
Thanks,
Anders
Hi,
This feels a bit hardcoded, but I think you always want to go 53 weeks back from the first day of the current week, so maybe =Date(today()-weekday(today())-(53*7))?
Cheers,
Chris.
Thanks Frank_Hartmann. That solution works this year because last year was a leap year, but next year it won't.
I'd rather have an dynamic expression that takes that into account.
For example =WeekStart(MakeWeekDate(year('2022-01-10')-1,week('2022-01-10'),0)) will show '2021-01-11' rather than 2021-01-04
Hi,
This feels a bit hardcoded, but I think you always want to go 53 weeks back from the first day of the current week, so maybe =Date(today()-weekday(today())-(53*7))?
Cheers,
Chris.
Great, thanks Chris - that does the trick!