Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
QlikSense_Best
Contributor
Contributor

Using all distinct values in a dimension in a variable

Hi all,

I'm trying to create an expression inside a variable that allows for multiple variable dropdown options. 

Ex: I have a dimension "Date" and I want to get all the distinct dates in this dimension to appear as dropdown options for the vDate Variable.

Is there a way to do this without having to add every single date as an alternative? Thank you!

Labels (3)
3 Replies
Digvijay_Singh

Not sure but I think you need an island date table to be created in the script.

I think you can utilize Rob's master calendar to quickly build that - 

https://qlikviewcookbook.com/2015/05/better-calendar-scripts/

hopefully you just need this section in the above link to customize for your need - 

LOAD
date(minDate + IterNo()) as TempDate
While minDate + IterNo() <= maxDate
;
LOAD
min(FieldValue('OrderDate',recno()))-1 as minDate,
max(FieldValue('OrderDate',recno())) as maxDate
AUTOGENERATE FieldValueCount('OrderDate');

QlikSense_Best
Contributor
Contributor
Author

I'll need to do this without adding any extensions, sorry about that.

vinieme12
Champion III
Champion III

Set the variable Input to Dynamic and add below expression

=concat(Distinct Date,'|')

 

vinieme12_0-1673836168884.png  

vinieme12_1-1673836258978.png

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.