Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
dineshm030
Creator III
Creator III

Comparison Last Year Sales Based On The Given Date Selection

Hi All,

I have created the Current Year and Last Year sales reports separately. I need to show the last year sales based on the given date.

Working Day CY DateKey LY DateKey
1 20230301 20220301
2 20230302 20220302
3 20230303 20220303
4 20230304 20220304
5 20230305 20220304
6 20230306 20220305
7 20230307 20220307
8 20230308 20220308
9 20230309 20220309
10 20230310 20220310
11 20230311 20220310
12 20230312 20220311
13 20230313 20220311
14 20230314 20220312
15 20230315 20220314
16 20230316 20220315
17 20230317 20220316
18 20230318 20220317
19 20230319 20220318
20 20230320 20220318
21 20230321 20220319
22 20230322 20220321
23 20230323 20220323
24 20230324 20220324
25 20230325 20220325
26 20230326 20220325
27 20230327 20220326
28 20230328 20220328
29 20230329 20220329
30 20230330 20220330
31 20230331 20220331

 

I select DateKey as 20230313 but LY sales should be show till 20220311 date. Same as remaining above dates.

Sum({<Year = {$(=max(Year)-1)},Date_Key = {"<=$(=Date(AddYears(Date#(Max(Date_Key),'YYYYMMDD'), -1), 'YYYYMMDD'))"}>}Sales_Value)

dineshm030_0-1679653420373.png

Thanks in advance.

@MayilVahanan @sunny_talwar 

Labels (2)
0 Replies