Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
joshabbott
Creator III
Creator III

Qlik Sense - Field Sorting in Filter Panel

Hello,

 

I'm having issues with sorting a field in the 'Filter Panel'.  For example, if I add a field called 'Year Month' to my dashboard with a filter object (sort 1)

joshabbott_1-1666790086613.png

 

 

I can filter by an expression to filter the field.  But once I make a selection and the field moves into the 'Filter Panel', I lose the sorting of this field (sort 2).

joshabbott_2-1666790098076.png

 

  Can anyone help me with a way to filter a field once it is in the filter panel?

Thank you,

Josh

 

Labels (1)
1 Solution

Accepted Solutions
joshabbott
Creator III
Creator III
Author

I did find a fix to my problem.  I found that the default sort in the filter pane is ascending order.  I wrapped a dual around my year month field and put the numeric value of the Year and Month as the second parameter:

Dual([YearMonthField],DateNum) as [Year Month F4]

When I did this, it sorted my Year Month F4 field in the filter pane ascending, or oldest to newest.  I needed it flipped to newest date first, down to the oldest date, so I adjusted the numeric value to make it the negative value of the date:

Dual([YearMonthField],DateNum*-1) as [Year Month F4]

 

This gave me the newest year/month values at the top down to the oldest.  

View solution in original post

7 Replies
RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @joshabbott 

That is because your Year Month field is a text field and not a date field.

I guess that in script you did something like this to create the field:

year(date_field) &' '& month(date_field) as [Year Month]

if so, you should try some date function like

Monthname(date_field) as [Year Month]

or

Date(date_field,'YYYY MMM') as [Year Month]

 

Hope this helps.

Best,

Help users find answers! Don't forget to mark a solution that worked for you & to smash the like button! 🙂

joshabbott
Creator III
Creator III
Author

Thank you for your reply!   So it is sorting it alphabetically by default?  Do I not have any way that I can change the way it sorts in this filter panel or is it always alphabetically?  Even if I did make this a date, it would sort the dates in ascending order, but I'd want it in descending order.  

RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @joshabbott 

Yes, it is default for text field

for numeric or date, the default would be numerical value.

in any case, for every object you have a section to specify the sorting criteria (text, numeric value, custom order) and also to set ascending or descending.

this video is for an old version but it’s similar

https://youtu.be/bSN7z04pFqM

 

hope this helps.

best,

Help users find answers! Don't forget to mark a solution that worked for you & to smash the like button! 🙂

RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi again,

One more thing that a just realize reviewing your post.

What o said applies to filter object or any chart object.

for the filters in the upper filter panel is default, you can’t change that.

 

Hope this helps.

best,

Help users find answers! Don't forget to mark a solution that worked for you & to smash the like button! 🙂

 

 

joshabbott
Creator III
Creator III
Author

I'm sorry, I stated my reply wrong.  So in the filter panel only (not an object on the dashboard) I have no control of the sort order?  It will always be descending based on the data type, I can't make it ascending?  The dimension value already selected in the filter panel is what I'm frustrated about not being able to change.  I have a user that makes a selection from a filter object on the dashboard, but then is trying to change the filter value from the filter panel and it is always sorted different, so they called this out to us.

RafaelBarrios
Partner - Specialist
Partner - Specialist

Now I got it.

sorry I misunderstood 

this is working as designed … sorry I can not help you with that.

https://community.qlik.com/t5/Official-Support-Articles/In-the-selection-bar-selection-list-sequence...

best.

Help users find answers! Don't forget to mark a solution that worked for you & to smash the like button! 🙂

joshabbott
Creator III
Creator III
Author

I did find a fix to my problem.  I found that the default sort in the filter pane is ascending order.  I wrapped a dual around my year month field and put the numeric value of the Year and Month as the second parameter:

Dual([YearMonthField],DateNum) as [Year Month F4]

When I did this, it sorted my Year Month F4 field in the filter pane ascending, or oldest to newest.  I needed it flipped to newest date first, down to the oldest date, so I adjusted the numeric value to make it the negative value of the date:

Dual([YearMonthField],DateNum*-1) as [Year Month F4]

 

This gave me the newest year/month values at the top down to the oldest.