Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with sorting months

Hello,

I'm using expression on sorting tab to sort months, but if I select month and then close the file and reopen it sorting is "broken" selected value is first and the others are not sorted as well. I tried using match function in the expression also num(Month) and everything works the same way.

=if(MonthLT = MonthSales and MonthSales = Month, Left(MonthLT, 1) & Mid(MonthSales, 2, 1) & Right(Month, 1))

This is my expression for the list box. I want to select months from all my calendars that's why I am doing this workaround.

Any help is appreciated!

1 Solution

Accepted Solutions
Not applicable
Author

At the end I am using this expression :

=if(MonthLT = MonthSales and MonthSales = Month, Date(Date#(Left(MonthLT, 1) & Mid(MonthSales, 2, 1) & Right(Month, 1) , 'MMM'),'MMM'))

My listBox has checked Show as TreeView property;

And on sorting tab checked Numeric Value Ascending

Now seems to be working, Thank You!

View solution in original post

3 Replies
reshmakala
Creator III
Creator III

For the selected value moving to the first, uncheck the state option on sort tab and retry.

JonnyPoole
Employee
Employee

Hi - what are the sample outputs of this expression:


"   Left(MonthLT, 1) & Mid(MonthSales, 2, 1) & Right(Month, 1)  "


Is it 'Jan', 'Feb' ,'Mar'  ?  


You may need to leverage dates to do this like this


Date(Date#( Left(MonthLT, 1) & Mid(MonthSales, 2, 1) & Right(Month, 1) , 'MMM'),'MMM') 


But to fix the sort order you may need SET ANALYSIS to cancel the user's selection for sorting purposes


Date(Date#(  only ( {1}  Left(MonthLT, 1) & Mid(MonthSales, 2, 1) & Right(Month, 1) ) , 'MMM'),'MMM') 

Not applicable
Author

At the end I am using this expression :

=if(MonthLT = MonthSales and MonthSales = Month, Date(Date#(Left(MonthLT, 1) & Mid(MonthSales, 2, 1) & Right(Month, 1) , 'MMM'),'MMM'))

My listBox has checked Show as TreeView property;

And on sorting tab checked Numeric Value Ascending

Now seems to be working, Thank You!