How to add Seasons to your Time Dimension

How to add Seasons to your Time Dimensions

When building a data model the Time Intelligence option will automatically additional time based attributes based on any date fields. Sometimes the Categories Year, Month, Week, Day are not enough and you need to add additional values. In this "How To", we will show you a way to add "Seasons" to your time intelligence

What is the plan?

Instead of using the Month, we want to show Seasons in the Report. (Think Fashion Retailer)

In our Case the Seasons will be defined as follows

  • Winter: December, January, February
  • Spring: March, April, May
  • Summer: June, July, August
  • Autumn: September, October, November

We will add this seasons directly to the Model

So how to solve this?

  1. Let's assuming you have a date field (i.e. transaction date) in your model, you can add a Time Intelligence node and this will automatically add a Month column.
  2. You can then add a Calculation node to create a new column – Season – in the calculation node you can write some PQL and use a case statement
Case(criteria([Date month name]="January",
[Date month name]="February",
[Date month name]="March",
[Date month name]="April",
[Date month name]="May",
[Date month name]="June",
[Date month name]="July",
[Date month name]="August",
[Date month name]="September",
[Date month name]="October",
[Date month name]="November",
[Date month name]="December"),
criteriaResults("Winter","Winter","Spring","Spring","Spring","Summer","Summer","Summer","Autumn","Autumn","Autumn","Winter"), "n/a")

Learn more about the  Case Statement here.