Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

limingthefirst
New Contributor III

Daily Year over Year in text object

Hi Everybody,

I am trying to get a year over year analysis to work both by year/quarter/month/week selections.

And also working in selected StartDate/EndDate calendar object.

So I can select any time interval by StartDate/EndDate calendar.

The variables for year over year I used below:

vLastYear=addmonths(MaxString(Delivery_Date),-12)

vCurrentYear=if(GetSelectedCount(Year)=0,max(Year),Year)


The value of Delivery_Date column is started from 1/1/2016.

Now I need to get a year over year value into text object:

Current Year Sales:

=sum({<Year={$(vCurrentYear)}>} Delivery_Amount)

Last Year Sales:

=sum({<Delivery_Date={">=$(=yearstart(vLastYear))<=$(=(vLastYear))"}>} Delivery_Amount)

The issue is when I don't select Year, the Last Year Sales is correct, but if I select 2017 in Year selections,

the Last Year Sales is 0.

If the time interval of Last Year Sales is out of Year selection or not?


Can anybody help me to correct the variables or extensions?


Many thanks

Ming

1 Solution

Accepted Solutions
Highlighted

Re: Daily Year over Year in text object

Try this

=Sum({<Delivery_Date={">=$(=yearstart(vLastYear))<=$(=(vLastYear))"}, Year>} Delivery_Amount)

2 Replies
Highlighted

Re: Daily Year over Year in text object

Try this

=Sum({<Delivery_Date={">=$(=yearstart(vLastYear))<=$(=(vLastYear))"}, Year>} Delivery_Amount)

limingthefirst
New Contributor III

Re: Daily Year over Year in text object

It's you! thank Sunny!