diff --git a/macros/business_kpis_configuration.sql b/macros/business_kpis_configuration.sql index 4ebfabc..596b454 100644 --- a/macros/business_kpis_configuration.sql +++ b/macros/business_kpis_configuration.sql @@ -20,6 +20,10 @@ It provides a proper display name for reporting purposes. {{ return(dimensions) }} {% endmacro %} +{% macro capitalise_and_remove_underscores(field_name) %} + initcap(regexp_replace({{ field_name }}, '_', ' ', 'g')) +{% endmacro %} + /* The following lines specify for each dimension the field to be used in a standalone macro. diff --git a/models/reporting/kpis/kpis__product_new_dash_agg_metrics.sql b/models/reporting/kpis/kpis__product_new_dash_agg_metrics.sql index 87a1999..aa62049 100644 --- a/models/reporting/kpis/kpis__product_new_dash_agg_metrics.sql +++ b/models/reporting/kpis/kpis__product_new_dash_agg_metrics.sql @@ -4,9 +4,9 @@ with ) select date as date, - time_granularity as time_granularity, - dimension as dimension, - dimension_value as dimension_value, + {{ capitalise_and_remove_underscores("time_granularity") }} as time_granularity, + {{ capitalise_and_remove_underscores("dimension") }} as dimension, + {{ capitalise_and_remove_underscores("dimension_value") }} as dimension_value, created_services as created_services, booking_with_created_services_count as booking_with_created_services_count from int_kpis__product_new_dash_agg_metrics diff --git a/models/reporting/kpis/schema.yml b/models/reporting/kpis/schema.yml index da30b53..a2e1f87 100644 --- a/models/reporting/kpis/schema.yml +++ b/models/reporting/kpis/schema.yml @@ -233,8 +233,8 @@ models: tests: - accepted_values: values: - - daily - - monthly + - Daily + - Monthly - name: dimension data_type: string @@ -242,14 +242,14 @@ models: tests: - accepted_values: values: - - global - - by_number_of_listings - - by_billing_country - - by_deal - - by_new_dash_version - - by_has_upgraded_service - - by_service - - by_host + - "Global" + - "By Number Of Listings" + - "By Billing Country" + - "By Deal" + - "By New Dash Version" + - "By Has Upgraded Service" + - "By Service" + - "By Host" - name: dimension_value data_type: string