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: 
alanwong1178
Contributor III
Contributor III

Qlik Sense variable dynamic value date sorting

I created a variable with drop down list to list out date in YYYY-MMM format

expression:=(Concat(distinct [SALES_DATE.autoCalendar.YearMonth],'|'))

I would like to change the ordering in the drop down list to be order by date instead of by alphabetical order

alanwong1178_0-1626849136995.png

 

Labels (4)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try putting sort weight in concat(), like:

=Concat(distinct [SALES_DATE.autoCalendar.YearMonth],'|', [SALES_DATE.autoCalendar.YearMonth])

Or

=Concat(distinct [SALES_DATE.autoCalendar.YearMonth],'|', Date#([SALES_DATE.autoCalendar.YearMonth]), 'YYYY-MMM')

View solution in original post

4 Replies
tresesco
MVP
MVP

Try putting sort weight in concat(), like:

=Concat(distinct [SALES_DATE.autoCalendar.YearMonth],'|', [SALES_DATE.autoCalendar.YearMonth])

Or

=Concat(distinct [SALES_DATE.autoCalendar.YearMonth],'|', Date#([SALES_DATE.autoCalendar.YearMonth]), 'YYYY-MMM')

alanwong1178
Contributor III
Contributor III
Author

Thanks. it works.

 

But I dont understand why we need to concat [SALES_DATE.autoCalendar.YearMonth]  with [SALES_DATE.autoCalendar.YearMonth] itself rather than just one [SALES_DATE.autoCalendar.YearMonth]

tresesco
MVP
MVP

It is not concatenating to itself, but the third parameter of concat() is for telling in which order the values should be concatenated, i.e. - as I already mentioned - it's sort-weight. 

Denzyl
Contributor II
Contributor II

Is there a way to do the reverse of the sort? Such that the latest month comes first