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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need to display the last 10 weeks(Values) in list box.

Hi,

I need to display the last 10 results in the list box(when list box contains more than 10 values).

201211
201212
201301
201302
201303
201304
201305
201306
201307
201308
201309
201310
201311
201312
201401
201402

from the above list i want to display the last 10 values.

Can some one help.

Regards,

rajesh

9 Replies
tresesco
MVP
MVP

List box: expression: something like:

Aggr( If( rank(YourField)<11, YourField), YourField)

Not applicable
Author

You can do it loading 10 last values on script, List Box cannot limit the values.

If the date values ​​are consecutive, you can do something like this in a expression:

IF(Date >= Max(Date)-10,Date). Do not forget hide null values.

jvishnuram
Partner - Creator III
Partner - Creator III

Hi Rajesh,

Try this

Aggr(only({$<Date={"$(=Max(Date)-10)"}>}Date),Date)

VJ
Not applicable
Author

hi tresesco,

But when i have selected any value from the result set(one value from 10 values in list box), the remaining values are going hidden.

and i want it to display even after selection of any value.

Regards,

Rajesh

tresesco
MVP
MVP

True, it would be so, because the calculation depends on the selection. Alternative could be, something like: create a variable in the script that holds the 10th max value and use that variable(which doesn't change on selection in the condition).

Load

          Max(YourField, 10) as Max

from <>;

Let v10thMax = Peek('Max');

Now, list box expression: =If( YourField>= v10thMax, YourField)

PFA

tresesco
MVP
MVP

Hey, got another idea for front end as well !

Define variable in the front end like: Variable1= Max({1}Field, 10)

PFA

Not applicable
Author

hi tresesco,

the above list box expression is not correct, i am getting the error.

Can you have a look.

Regards,

Rajesh

tresesco
MVP
MVP

Have you checked my second attachment?

Variable1=Max({1} Field , 10)

=If(Field>=Variable1,Field)   // list box expression

Edit: Variable definition corrected.

Not applicable
Author

hey tresesco,

Tried again and it is not coming.

could you please do an attachment if possible.

thanks in advance.

regards,

rajesh