Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
kwl1234
Partner - Contributor III
Partner - Contributor III

How to find previous year same days sales?

Existing expression for getting last year sales.

Sum({$<[SALES.fYear2]=, [SALES.Month]=,SALES.SALES_DATE, [SALES.FiscalDateNum]={">=$(=Num(YearStart(Max(addyears([SALES.FiscalDateNum],-1)))))<=$(=num(addyears(Max([SALES.FiscalDateNum]),-1)))"}>} [SALES.NET_AMOUNT])

 

However, when I select SALES.fYear2 = 2021 and SALES.Month = May. On the previous year table shows the SALES.SALES_DATE up to 05/28/2020.  There are 05/31/2021. So, 31,29,30 on May are missing. I don't know what happen on my expression. It only having a issues on 05-2020

kwl1234_0-1625463733491.png

 

 

 

I tried to using below expression for obtain previous year date, the results look fine.

Sum({$<[SALES.fYear2]=, [SALES.Month]=,SALES.SALES_DATE,[SALES.fYear2]={$(=only([SALES.fYear2])-1)}>} [SALES.NET_AMOUNT])

 

kwl1234_0-1625463051983.png

 

But when I select SALES.fYear2 = 2021 and SALES.Month = Jul, it always showing the whole month of last year sales.

I only want to show the last year date same as selected year, not the whole month of last year.

kwl1234_1-1625463321319.png

 

 

 

0 Replies