Qlik Community

Ask a Question

New to QlikView

If you’re new to QlikView, start with this Discussion Board and get up-to-speed quickly.

Announcements
Qlik Highlights 2020 Giveaway! Watch, reply and have a chance to win a $200 Amazon Gift Card! Watch Video
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor III
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

Try this

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

View solution in original post

2 Replies

Try this

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

View solution in original post

Contributor III
Contributor III

It's you! thank Sunny!