Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pivot table - sort by current month first, then next 11 months

Hi All,

I have a pivot table that has month along the column names. Data is looking at the next 12 months (ie, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Jan), looking from 2015-2016

Requirement is to have the sort order always have the current month first. I use Month as opposed to MonthYear (which would solve my issue) as under each month I have three columns for the previous year, the current year and a percentage difference:

Month order.jpg

I've got a custom sort expression that uses Mod() to set the sort order. This works fine, but I need to change the expression every month to keep the order correct:

=Mod(SERVICEMONTH+10,12)

i.e. - the expression above is fine for when SERVICEMONTH = Feb, but as soon as we move in to March and I want March to appear first in the list I'll need to update the expression to

=Mod(SERVICEMONTH+9,12)


and so on.


Is there any way to make this expression more dynamic, or is there an alternative solution someone can suggest?


Thanks,


Rory.

2 Replies
morganaaron
Specialist
Specialist

To stick to your current method, could you replace the number with:

12-Month(Today())

Or do you need to control when it changes?

Not applicable
Author

Hi Aaron,

Only want it to change when the calendar month changes, so that should work - thank you. As soon as we move in to March I'll double check and come back and mark as correct if it's working as anticipated.