Helper Variables: Dynamic 'daysInMonth' Equivalent for Different Time Dimensions

Hi Causal Team,

I would like to propose an enhancement for the helper variable feature in Causal, specifically the ‘daysInMonth’ helper. This feature plays a significant role in our comprehension of operating metrics whenever the granularity of our time dimension is adjusted.

Problem Statement

I’ve observed a couple of limitations which, if addressed, could notably enhance user experience and flexibility:

(1) The lack of flexibility with the ‘daysInMonth’ helper variable when altering time dimensions: When the time dimension is adjusted to a weekly granularity, we’re currently obliged to replace the ‘daysInMonth’ helper with a hardcoded ‘7’. This procedure is neither intuitive nor efficient.

(2) The incapacity to apply a rollup (e.g., quarterly) without encountering errors. This issue poses a challenge when users need to analyse data over differing periods.


The current constraints inhibit users from dynamically adjusting the time dimension to suit their analytical needs. This situation leads to unnecessary friction and the expenditure of time, as users are required to manually reconfigure the formulas each time the time dimension is modified. Instead of focusing on analysis, users are expending time on configurations, which adversely impacts productivity.

Proposed Solution

I propose the introduction of a ‘daysInPeriod’ helper variable that auto-adjusts based on the selected time dimension (weekly, monthly, quarterly, etc.). This enhancement would eliminate the need to manually adjust formulas, thus facilitating a seamless transition between different time dimensions and ultimately improving user workflow.


Hey @sarviinageelen,

Really appreciate this write up!

Please see my responses to your observations below:

  1. How often are you changing time granularity of the model? We expect this to be a rare action so it’s interesting that you say this has caused significant delays. If you want to see different time granularities of the same underlying model I would suggest keeping multiple models and having them linked to a source of truth for inputs rather than changing the granularity of one model regularly if that’s what you are doing?

  2. Unsure what errors you are encountering here? Could you share an image/recording please?

I do like your proposed daysInPeriod helper variable and will flag to the team!