How do have wk. 52 show as 2021 and not 2022?

  • 4 January 2022
  • 1 reply

We have a dimension_group that extracts timeframes from a timestamp field. We want to compare year over year for week_of_year. However, the dates 01/01/2022 and 02/01/2022 are extracted as wk. 52 but year 2022. This then causes confusing results in our line graphs. Is there a way to have these dates follow the same year as the week number e.g. they would be in year 2021 even though they are actually in year 2022. 

1 reply

Userlevel 6
Badge +1

the week_of_year timeframe, I believe, works on EXTRACT(WEEK) or equivalent of your chosen dialect, but there’s no way to change its calculation. Creating a shift of week number is not hard but the impossible part is making it a result of the timeframe so that you can still use the dimension group.


The only thing you could do is to create a new dimension called Week of Year and perform the offset change in your SQL statement.


You won’t be able to use a dimension_group on this one