Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

Rolling Last 4 Years

Hi All,

I want to show data like if i click 2013 year in list box, straight table will be shown 2013,2012,2011,2010 years data with Revenue metric

Please let me get solution for this Requirement

Thanks in Advance

Nihhal

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

Please see the attached sample.

Expression like:

sum({<Year = {">=$(=(Max(Year), -3))<=$(=(Max(Year)))"}>}Sale)

View solution in original post

5 Replies
Not applicable

HI Nihhal L,

I had a similar inquiry earlier, please find there the best answer with a brilliant solution:

http://community.qlik.com/thread/35870

With similar logic, you can flag years if you do not want to display exact 48 months.

Let us know how it goes.

Best wishes,

nihhalmca
Specialist II
Specialist II
Author

Thank you for reply Kadir i want yera wise suppose i have only year dimension like 2008,09,10,11,12.....

Not applicable

Hi Nihhal L,

You may wish to try:

sum({<Year ={">=$(=Date(AddYears(Date#(max(Year),'YYYY'),-4),'YYYY')) <=$(=Date(AddYears(Date#(max(Year),'YYYY'),0),'YYYY'))"} >} Sales)

in your expression.

What this does is, it finds the maximum year and sets range from now until 4 years back.

In some occasions, you may wish to limit your data to last year's end. In that case, set it like:

sum({<Year ={">=$(=Date(AddYears(Date#(max(Year),'YYYY'),-4),'YYYY')) <=$(=Date(AddYears(Date#(max(Year),'YYYY'),-1),'YYYY'))"} >} Sales)

Changes were indicated in red font for your convenience.

Hope that helps. Let us know how it goes.

Best wishes,

tresB
Champion III
Champion III

Please see the attached sample.

Expression like:

sum({<Year = {">=$(=(Max(Year), -3))<=$(=(Max(Year)))"}>}Sale)

nihhalmca
Specialist II
Specialist II
Author

Thank You tresesco.

NiHhal.