Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
kunkumnaveen
Valued Contributor

max year to last three yr sales

Hello All,

As i got couple of years data and i am trying to get sales in between max(year ) to previous 3 year ,

the expression that i wrote in my bar is this

sum({1<Year007={">=$(=Year(YearStart(max(Year007),-3)))<=$(=max(Year007))"}>}Sales007)

which is not bring me an appropriate output so definately i made a mistake but as for my knownledge the expression look pretty ok ,

please can any one suggest me what wrong with this expression ./..thanking you in advance

kumar

4 Replies
Highlighted
balrajahlawat
Esteemed Contributor

Re: max year to last three yr sales

try this:

=sum({<Year007={'>=$(=max(Year007)-3)'}>} Sales007)


Agreed with Peter, try this:


=sum({<Year007={'>=$(=max(Year007)-3)<=$(=max(Year007))'}>} Sales007)


Note: I hope Year007 contains value like 2012,2013,2015 etc


Highlighted
Not applicable

Re: max year to last three yr sales

Highlighted
HirisH_V7
Honored Contributor

Re: max year to last three yr sales

Hi,

If your data contains till today and real time approach will be like this,

Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=YearStart(Today(), -3))<=$(=Today())’}>} Sales )



or else with your Date field ,



Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=YearStart(Max(Date), -3))<=$(=Date(Max(Date)))’}>} Sales )


else year field,check this,


N-period rolling data, moving average, easy solution.



Hope this helps,

Regards,

HirisH

HirisH
“Aspire to Inspire before we Expire!”
Highlighted

Re: max year to last three yr sales

Watch out, Balraj. there is no upper limit in your set analysis. A set modifier will start from all values in Year007 and therefor will include 2000-2015 if you select for example 2003 in Year007.