8 Replies Latest reply: Feb 3, 2016 8:40 AM by Anuraj kokkeragadda

To Display Year Vs Previous Year dynamically

Hi,

I am new to qlikview.I am yet in the learning .Could any one suggest the expression of set analysis to display Sales of Current Year Vs Previous Year dynamically by selecting the Year .(Like 2015 Vs 2014 Sales.)

Thank you.

• Re: To Display Year Vs Previous Year dynamically

=Sum({<Year = {\$(=Max(Year))}>} Sales) / Sum( {<Year = {\$(=Max(Year)-1)}>} Sales) -1

edit: Or in two expressions:

=Sum({<Year = {\$(=Max(Year))}>} Sales)

= Sum( {<Year = {\$(=Max(Year)-1)}>} Sales)

• Re: To Display Year Vs Previous Year dynamically

Thank you sweuhl.Its working correctly

• Re: To Display Year Vs Previous Year dynamically

Hi Sweuhl,Could you suggest me the way to display like

='2015 Vs 2014 Sales:  '  &  Num(Sum({<Year={'2015'}>} Sold_Price)/Sum({<Year={'2014'}>} [Sold_Price])-1,'#0.%').

My concern is that using the same expression above could i display '2015 Vs 2014 Sales:  ' dynamically according to the selection made for the year

• Re: To Display Year Vs Previous Year dynamically

Would you be able to share a sample?

• Re: To Display Year Vs Previous Year dynamically

!

This was which i would like to represent .But the 2015 Vs 2014 Sales should be displayed according to the year i am selecting

• Re: To Display Year Vs Previous Year dynamically

Create Variable

vMaxYear=   max(Year)

VLastYear= (max(Year)-1)

Then use Below expression

\$(vMaxYear)& ' Vs '& \$(VLastYear) &' Sales:  '  &  Num(Sum({<Year={'2015'}>} Sold_Price)/Sum({<Year={'2014'}>} [Sold_Price])-1,'#0.%').

• Re: To Display Year Vs Previous Year dynamically

Thank you John

• Re: To Display Year Vs Previous Year dynamically

Don't you want to use the variables also in the set expressions?

\$(vMaxYear)& ' Vs '& \$(VLastYear) &' Sales:  '  &  Num(Sum({<Year={\$(vMaxYear)}>} Sold_Price)/Sum({<Year={\$(VLastYear)}>} [Sold_Price])-1,'#0.%')

But in general, the dynamic display depending on selections should work the same way I showed in my first post.