How to sort starting with the current month

  • 15 July 2021
  • 0 replies

When we sort chronologically - it starts with January - December

How can we sort so that the first row is always the current month, like in this screenshot:


Sort starts on July (article written on 7/15/202​​1)


We can sort on a table calculation (which we will hide from the visualization so it doesn’t get plotted)


If the month column’s value > current month (ex. Row 2, August > July evaluates to true)
we'd take the month_num and subtract the current month value (8 - 7)
If not, we would add them (ex. Row 9, March > July evaluates to false, we’ll take 3 + 7)

The table calc syntax looks something like this:

${orders.order_month_num} >= extract_months(now()),
${orders.order_month_num} - extract_months(now()),
${orders.order_month_num} + extract_months(now())


0 replies

Be the first to reply!