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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort months in string

Hi guys,

I am using text box to show curremt selection:

='>> ' &

Year
& ' > '&
concat(DISTINCT if(len(Quarter)>1,Quarter), ', ')
& ' > '&
concat(date([DB Date]), ', ')

so in result I will have >>year>quarter>month

the problem is that if I will select more than 1 month it will sort months alfabeticaly.

Is there any way to stop sorting?

Thank you,

Andrzej

1 Solution

Accepted Solutions
tresesco
MVP
MVP

If you want the like: Jan, Feb, Mar.. then try like:

concat(Distinct month([DB Date]), ',', month([DB Date]))

the second 'month([DB Date])' defines the sort order.

View solution in original post

6 Replies
rubenmarin

Hi, maybe:

='>> ' &

Year
& ' > '&
concat(DISTINCT if(len(Quarter)>1,Quarter), ', ')
& ' > '&
concat(date([DB Date]), ', ', date([DB Date]))


If not, can you post a sample of the data to make tests?

its_anandrjs
Champion III
Champion III

In text i don't believe you sort it but you can use the straight table for this with only expression.

Regards,

Anand

Not applicable
Author

I am sorry I add wrong formula in OP

the formula from OP works fine as it has full date. but i want to show months only, and then it sorts incorrectly:

 

='>> ' &

Year
& ' > '&
concat(DISTINCT if(len(Quarter)>1,Quarter), ', ')
& ' > '&
concat(month([DB Date]), ',')

MarcoWedel

please post sample data/app

tresesco
MVP
MVP

If you want the like: Jan, Feb, Mar.. then try like:

concat(Distinct month([DB Date]), ',', month([DB Date]))

the second 'month([DB Date])' defines the sort order.

Not applicable
Author

Thanks, this is what I needed. It works after little adjustment

concat(month([DB Date]), ', ',date([DB Date]))