Skip to main content
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

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. 😀