removed macro and kept all logic inside the model

This commit is contained in:
Joaquin 2025-04-02 12:01:57 +02:00
parent 78e2474a87
commit ab179577b1
15 changed files with 52 additions and 53 deletions

View file

@ -171,16 +171,13 @@ Provides a general assignement for the Dimensions available for each KPI
] %}
{% endif %}
{% if entity_name == "NEW_DASH" %}
{% 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_DEALS_OFFERED_SERVICES" %}
{% if entity_name in [
"NEW_DASH_CREATED_SERVICES",
"NEW_DASH_CHARGEABLE_SERVICES",
"NEW_DASH_ACCOMMODATION_OFFERED_SERVICES",
"NEW_DASH_CREATED_BOOKINGS",
"NEW_DASH_DEALS_OFFERED_SERVICES",
] %}
{% set additional_dimensions = additional_dimensions + [
dim_has_upgraded_service(),
dim_new_dash_version(),

View file

@ -1,23 +0,0 @@
{% 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 %}