Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
vicente89
Contributor II
Contributor II

Get the data for the same day of the same week of the same week last year.

I want to get the data for the same day of the same week of the same week last year. Example:
Today is: Wednesday, October 3, week 40 of 2023.
I want: Wednesday (October 2 in this case) of week 40 of 2022.

I have tried the following formulas and they don't work:
- SUM({<fecha_creacion_del_pago={'$(=Date(YearStart(Today()) - 1) + WeekDay(Today()) - WeekDay(Today(1)) - 7))'}>} venta_neta_reserva)
- SUM({<fecha_creacion_del_pago={'$(=Date(WeekStart(Today()) - 365 + WeekDay(Today()) - 1))'}>} venta_neta_reserva)
- SUM({<fecha_creacion_del_pago={'$(=AsOfDate(Today(), -364))'}>} venta_neta_reserva)

In Power BI it could be the following formula:
"totalsales DATEADD = CALCULATE([Total Sales], dateadd('Date'[Date], -364, DAY))".

2 Replies
jochem_zw
Partner Ambassador
Partner Ambassador

Please try something like this:

SUM({<fecha_creacion_del_pago={"$(=Date(Today() -364))"}>} venta_neta_reserva)

keinel2
Contributor
Contributor

I agree with the suggestion for a date dimension table. But… you should be able to self join reservations r1 to reservations r2 on

r1.ArrivalDayofWeek = r2.ArrivalDayofWeek and r1.ArrivalWeekum = r2.ArrivalWeeknum and year(r2.ArrivalDate) = year(r1.ArrivalDate)-1