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: 
Bashar
Contributor III
Contributor III

Getting Last Year Sales based on Last Year Date

Hello all,

I'm facing a challenge getting last year sales based on a last year date we have, I have to use this date for comparison so I can't use the AddYear() or any of the system functions because of some special cases that require this logic. Basically I have my table below, and I want to write an expression for a master item (Sales LY). I've simplified the question in the below table.

Date Date LY Sales Sales LY
27/04/2024 29/04/2023 1,000 ?
26/04/2024 28/04/2023 2,340 ?
25/04/2024 27/04/2023 1,291 ?
24/04/2024 26/04/2023 3,382 ?
23/04/2024 25/04/2023 3,928 ?
| | | |
| | | |
29/04/2023 30/04/2022 1,283 ?
28/04/2023 29/04/2022 3,728 ?
27/04/2023 28/04/2022 1,827 ?
26/04/2023 27/04/2022 3,827 ?
25/04/2023 26/04/2022 7,482 ?

if I put this master item in a table with the 3 already provided columns, the orange numbers would populate the question marks.

Appreciate your support 🙂

Labels (6)
1 Solution

Accepted Solutions
brunobertels
Master
Master

Hi 

souds like this link is what your looking for : 

https://www.qreatic.fr/dailyqlikchallenge/2021/6/04/69-same-day-previous-year-comparison-in-qlik-sen... 

As your last year date is equal to this year date - 364 you can use a pivot table between your fact table and your calendar table. 

regards

View solution in original post

2 Replies
brunobertels
Master
Master

Hi 

souds like this link is what your looking for : 

https://www.qreatic.fr/dailyqlikchallenge/2021/6/04/69-same-day-previous-year-comparison-in-qlik-sen... 

As your last year date is equal to this year date - 364 you can use a pivot table between your fact table and your calendar table. 

regards

Bashar
Contributor III
Contributor III
Author

Thanks so much for the link, this method worked!