Label Names for Rolling Months
I have a business view with columns that aggregate monthly usage. This is a rolling aggregation. For example, the column label "Current Month" is the current month (i.e. September). However, in a few days "Current Month" will change to October. Is there a way to display the column label in sync as the months change? Or is it only possible to just manually update it every time a new month begins?
I use session variables for currentMonthName and twoMonthAgoMonthName for an insight that does this. The column names use these session variables to dynamically roll the names.
For example, I have a column name that shows variance between last month and two months ago. The name is rendered using this string:
%Variance ($$currentMonthName - $$twoMonthAgoMonthName)
The session variable definition for the two months ago name uses this formula (although I suspect there are many ways to get this)
name = twoMonthAgoMonthName queryDistinct( Date_Time.Date.Month_Name, Date_Time.Date.Month_End_date = addDays( $lastMonthStart, -1 ) ) name = currentMonthName queryDistinct( Date_Time.Date.Month_Name, Date_Time.Date.Month_Start_date = $currentMonthStart )
Formulas and filters in the insights use paired session variables to hold the dynamic dates as well. It can get a bit hard to read, but it works well. I have twoMonthsAgoEndDate, twoMonthsAgoStartDate and twoMonthsAgoMTD to match the twoMonthAgoMonthName. Likewise for currentMonthName.