-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CT-1183] [Feature] metrics should be configurable to show nulls for missing data after spining #5842
Comments
Thanks @dave-connors-3! Agree that this should always be consistent for all calculations of a given metric. That said - this feels to me more like a standard configuration that could apply to several metrics, more so than an integral part of a metric's unique definition. Could we imagine adding other properties like this one, which don't define the metric per se, but configure how it should be executed (= calculated)? Here's a thought / alternative approach:
So in your dbt project code: version: 2
metrics:
- name: new_customers
...
config:
enabled: true
fill_missing_values: true Bonus: if this is a config, you could even set a default for all metrics in your project / a package: # dbt_project.yml
metrics:
my_project:
+fill_missing_values: true And somewhere in the -- what should the default behavior be?
{% set fill_missing_values = dict_metric.get("config").get("fill_missing_values", False) %}
...
{% if fill_missing_values %}
coalesce(...)
{% else %}
...
{% endif %} @callum-mcdata @dbeatty10 Curious to get your thoughts here too. I see this as a potential pattern that could also enable fewer "migrations" to the metrics spec in the future. Addendum: What's the difference between
|
it WHAT. Today I learned! |
Note: |
Totally in alignment with your thinking here @jtcohen6! This absolutely fits as a config to adjust the ergonomics of using a particular metric,more so than "an integral part of a metric's unique definition." @leahwicz -- totally agree with your feedback here too! Do you have suggestions for better naming? was trying to balance brevity and clarity |
also I think we are clear to close this issue and #5843! |
Closing as this can be handled solely within Agree with the naming suggestion! Verbose-r is better for something this subtle, and |
Is this your first time submitting a feature request?
Describe the feature
When using metrics in dbt, the metrics package will currently fill in any missing value after a metric has been date spined with the value 0. This has some implications for derived metrics that may divide by a zero value -- in discussing a fix for that particualr issue, and hearing some feedback from the community, we realized that we need a configurable, consistent way for using to decide the way that a metric is reported, either with null values or zeros.
A new optoinal metric attribute
fill_missing_values
would allow users to declare whether or not a metric returns 0 or null when there is missing data after datespining a metric.Describe alternatives you've considered
Letting this be a option passed to the
dbt_metrics.calculate()
macro. This could be considered a display option rather than an attribute of a particular metric. However, @joellabes said it well:Who will this benefit?
metrics users new and old
Are you interested in contributing this feature?
yeah!
Anything else?
No response
The text was updated successfully, but these errors were encountered: