Sorting by month and year | Community
Skip to main content

Sorting by month and year

  • January 12, 2017
  • 4 replies
  • 0 views

 

Sometimes when you are using MONTH and YEAR date attributes, BIME might not sort the dates properly. When we added the MONTH and YEAR attributes in that order, our results ended up looking something like this:

 

 

 

The solution

 

With the help of a couple calculated measures and a sorting option, we can change the order of our results. 

 

To sort dates by Month and Year:



    1. In the Calculation Engine menu, click Standard Calculated Measure. 

 

    1. Name your measure Date Timestamp.

 

    1. Type in DATE_TO_TIMESTAMP.

 

    1. Select a DATE attribute from your Fields drop-down list.

 

    1. Add your calculated measure as a tooltip with the AVG aggregator. 

 

    1. Go back to the Calculation Engine menu, then select Standard Calculated attribute. 

 

    1. Type in the following formula: [MONTH(your added month)+ " "+[YEAR(your added month)] 

 

    1. Add your attribute to Columns.

 

    1. In the Advanced sort options, sort your query based on your newly created measure. 



Your query will now display results in the correct order!

4 replies

  • January 12, 2017

Awesome tip Marion!


  • April 8, 2019

We're kind of surprised such a basic attribute isn't immediately available once one starts creating with Explore... thank you so much for this!


Ifra
  • February 27, 2020

It's a really great tip. Thanks for sharing Marino.


  • June 29, 2021

Yeah, Insights had month/year, week/year, etc right out of the box. E.g. "wk 52 2020, wk 1 2021," etc. That concept seems entirely missing from Explore attributes. It's disappointing that you have to make them yourself.