Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
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 (5)
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

3 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')

View solution in original post

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.