Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

nareshthavidishetty
Contributor III

Expression YOY

Hi,

We have used the below logic to get last year MTD sales.(Ex:2015,Dec 1 to 13 sales).

Here i need to calculate previous year sales(Ex:2015,Dec 1 to 13 sales)

Logic to get 2015 DEC MTD sales :

sum({$<Year = {$(=max(Year)-1)},Month = {"<=$(=max({<Year={$(=max(Year))}>}Month))>$(=max({<Year={$(=max(Year))}>} Month)-1)"},      [Reported Date] = {"<=$(=addyears(max([Reported Date]),-1))"},[Current Sales Class Nbr]  = {001}>} TOTAL ([Invoice Merchandise Amt] + [Invoice Price Concession Amt]))

Reported Date format ='MM/DD/YYYY'

Please provide the logic to get 2014 sales.

Thanks..

Tags (1)
1 Reply
adamdavi3s
Honored Contributor

Re: Expression YOY

Firstly I would highly recommend using a flag in the calendar to generate this sort of thing, it makes life a lot easier!

I think these are the only two places you need to change it but my brain isn't totally up to speed today

sum({$<Year = {$(=max(Year)-2)},Month = {"<=$(=max({<Year={$(=max(Year))}>}Month))>$(=max({<Year={$(=max(Year))}>} Month)-1)"},      [Reported Date] = {"<=$(=addyears(max([Reported Date]),-2))"},[Current Sales Class Nbr]  = {001}>} TOTAL ([Invoice Merchandise Amt] + [Invoice Price Concession Amt]))