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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Values that lies between two variables

Hi,

Can you please help me to resolve this issue :

I have to list the years between a selected year Y and Y-1.

For example:

My selected Year is : 2013

The number of years on the past is : V_YearBack = 3

So i have to get : 2013 2012 2011 2010

Can any one help me ?

Thanks

12 Replies
Clever_Anjos
Employee
Employee

Something like

sum({<Year ={">=$(=MAX(Year)-$(V_YearBack ))"}*{"<=$(=MAX(Year))"}>} yourfield)

should solve your need

Not applicable
Author

Hi,

Thanks for your response but this doesn't resolve my problem.

I put : =sum({<Year ={">=$(=MAX(Year)-$(V_YearBack ))"}*{"<=$(=MAX(Year))"}>} Year)

and i got : Error on Dimension

Any other suggestion ?

Josh_Good
Employee
Employee

I have a few thoughts on how this could be done but it would depend on where you want the list to appear.  Could you please post a sample QVW showing where you need the list to appear.

Not applicable
Author

Hi ,

  Please use the code as below

=Sum({$<Year ={">=$(=(max(Year ))-$(V_YearBack)-1) <=(max(Year ))"}>} FieldName)

Regards

Yusuf

Not applicable
Author

Hi,

Please find attached my example.

What i want is : when i select for example 2013 and YearBach=3, i have to get on the table those years : 2013, 2012,2011

Can you help please ?

Not applicable
Author

Still the same error message

Not applicable
Author

Hi ,

can you please try now .

=Sum({$<Year ={">=$(=(max(Year ))-$(V_YearBack)) <=$(=(max(Year) ))"}>} Sales)


Also please find the attachment .

Regards

Yusuf

Not applicable
Author

Hi Yusuf,

I tested the solution that you sent me and i think this will resolve a part of my problem

Thank you so much for your help ... i will add this part of development on my application and i will let you know if it is ok.

Thanks

Not applicable
Author


Many Thinks it works