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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
MatsR
Contributor II
Contributor II

Qlik sense sort by expression asc/desc depending on filter

Hello all, I have a bar chart which contains YYYYMM on the x-axis which i want to sort asc/desc depending on how many months which are filtered. 

I have a filter containing YYYYMM, if the user selects 15 months or less I would like to sort the x-axis ascending othervise descending. Is this possible?

Br Mats

Labels (1)
4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think the approach would be to set the sort direction to "ascending" and negate the value in your sort expression. A sort expression like:

if(Count(Distinct MonthYear) <= 15, MonthYear, -MonthYear)

-Rob

 

BrandonFontes
Partner - Contributor III
Partner - Contributor III

Is that what you need?

Project Leader and Qlik Specialist at Work Avanti Solutions | www.avantisolucoes.com.br
MatsR
Contributor II
Contributor II
Author

Thanks for your reply, thats not quite what i'm looking for.

MatsR
Contributor II
Contributor II
Author

Thanks for your reply, yes this seems to what Im looking for, I cant get it to work though. It seems that the if condition always is true regardless how many months i choose. I i switch the '-' to the first MonthYear the sort order changes so I have to look into what Im doing wrong. Thanks for your help.