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: 
Shahzad_Ahsan
Creator III
Creator III

Sorting by Month

Hi

I want to display last 12 months data in bar chart, but the sorting order should be like this:

Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,Jan,Feb,Mar

So the data is showing between Apr-2019 to Mar-2020

Current month will always be last.

Suppose when April-2020 will come , then the sorting order will be like this:

May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,Jan,Feb,Mar,Apr

 

 

 

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

One crude expression you can try for sorting like:

 

=If(
Month(Date#(Month, 'MMM'))-Month(Today())
<1, Month(Date#(Month, 'MMM'))-Month(Today())+12,
Month(Date#(Month, 'MMM'))-Month(Today()))

 

Or if your month is a proper dual field, i.e. - number at the back, you can replace "Month(Date#(Month, 'MMM'))" with just 'Month' field

View solution in original post

2 Replies
tresesco
MVP
MVP

One crude expression you can try for sorting like:

 

=If(
Month(Date#(Month, 'MMM'))-Month(Today())
<1, Month(Date#(Month, 'MMM'))-Month(Today())+12,
Month(Date#(Month, 'MMM'))-Month(Today()))

 

Or if your month is a proper dual field, i.e. - number at the back, you can replace "Month(Date#(Month, 'MMM'))" with just 'Month' field

View solution in original post

Shahzad_Ahsan
Creator III
Creator III
Author

Hi @tresesco 

I replaced my month field here:  Month(Date#(Month, 'MMM')) and it worked perfectly. 

Thanks a lot. 😀