Addressed comments
This commit is contained in:
parent
264ce4e203
commit
60dfae5cf4
16 changed files with 147 additions and 236 deletions
|
|
@ -171,16 +171,7 @@ Provides a general assignement for the Dimensions available for each KPI
|
|||
] %}
|
||||
{% endif %}
|
||||
|
||||
{% if entity_name == "NEW_DASH_CREATED_SERVICES" %}
|
||||
{% set additional_dimensions = additional_dimensions + [
|
||||
dim_has_upgraded_service(),
|
||||
dim_new_dash_version(),
|
||||
dim_pricing_service(),
|
||||
dim_pricing_business_type(),
|
||||
] %}
|
||||
{% endif %}
|
||||
|
||||
{% if entity_name == "NEW_DASH_CHARGEABLE_SERVICES" %}
|
||||
{% if entity_name == "NEW_DASH" %}
|
||||
{% set additional_dimensions = additional_dimensions + [
|
||||
dim_has_upgraded_service(),
|
||||
dim_new_dash_version(),
|
||||
|
|
@ -198,24 +189,6 @@ Provides a general assignement for the Dimensions available for each KPI
|
|||
] %}
|
||||
{% endif %}
|
||||
|
||||
{% if entity_name == "NEW_DASH_ACCOMMODATION_OFFERED_SERVICES" %}
|
||||
{% set additional_dimensions = additional_dimensions + [
|
||||
dim_has_upgraded_service(),
|
||||
dim_new_dash_version(),
|
||||
dim_pricing_service(),
|
||||
dim_pricing_business_type(),
|
||||
] %}
|
||||
{% endif %}
|
||||
|
||||
{% if entity_name == "NEW_DASH_CREATED_BOOKINGS" %}
|
||||
{% set additional_dimensions = additional_dimensions + [
|
||||
dim_has_upgraded_service(),
|
||||
dim_new_dash_version(),
|
||||
dim_pricing_service(),
|
||||
dim_pricing_business_type(),
|
||||
] %}
|
||||
{% endif %}
|
||||
|
||||
{# Combine base dimensions with additional dimensions for the specific model #}
|
||||
{% set dimensions = base_dimensions + additional_dimensions %}
|
||||
{{ return(dimensions) }}
|
||||
|
|
|
|||
23
macros/generate_kpis_aggregation.sql
Normal file
23
macros/generate_kpis_aggregation.sql
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{% macro generate_kpis_aggregation(time_granularity, agg_models) %}
|
||||
select
|
||||
d.date,
|
||||
'{{ time_granularity }}' as time_granularity,
|
||||
d.dimension,
|
||||
d.dimension_value
|
||||
{%- for agg_model in agg_models if time_granularity in agg_model["name"] %}
|
||||
{%- for metric in agg_model["metrics"] %}
|
||||
, coalesce({{ ref(agg_model["name"]) }}.{{ metric }}, 0) as {{ metric }}
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
from all_dates d
|
||||
{%- for agg_model in agg_models if time_granularity in agg_model["name"] %}
|
||||
left join
|
||||
{{ ref(agg_model["name"]) }}
|
||||
on d.date = {{ ref(agg_model["name"]) }}.{{ agg_model["date_field"] }}
|
||||
and d.dimension = {{ ref(agg_model["name"]) }}.dimension
|
||||
and d.dimension_value = {{ ref(agg_model["name"]) }}.dimension_value
|
||||
{%- endfor %}
|
||||
{% if time_granularity == "weekly" %} where d.is_end_of_week
|
||||
{% elif time_granularity == "monthly" %} where d.is_end_of_month
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue