The problem I’m having
I am trying to create a cumulative metric with grain_to_date set as “fiscal_month” which is defined in a custom calendar, but I’m getting an error.
The context of why I’m trying to do this:
My Month to Date metric is driven based on fiscal calendar
What I’ve already tried:
Define model as follows:
models:
- name: d_fiscal_calendar
description: This is a fiscal year calendar that will be used as custom time spine.
time_spine:
standard_granularity_column: day_key
custom_granularities:
- name: fiscal_month
column_name: mth_key
columns:
- name: day_key
granularity: day
- name: mth_key
And define metric as follows:
metrics:
- name: mtd_sales
description: 'MTD Sales Retail, based on fiscal calendar'
type: cumulative
label: mtd_sales
type_params:
measure:
name: sales
grain_to_date: fiscal_month
error message i’m getting:
ValueError: Invalid enum value: `fiscal_month` in enum TimeGranularity