From 4c011d70634d3f3d1c6ebf0095eacd3983e9b9c1 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Wed, 2 Apr 2025 12:55:04 +0200 Subject: [PATCH] Changed loop --- .../kpis/int_kpis__product_new_dash_agg_metrics.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/intermediate/kpis/int_kpis__product_new_dash_agg_metrics.sql b/models/intermediate/kpis/int_kpis__product_new_dash_agg_metrics.sql index f6719e2..88b174f 100644 --- a/models/intermediate/kpis/int_kpis__product_new_dash_agg_metrics.sql +++ b/models/intermediate/kpis/int_kpis__product_new_dash_agg_metrics.sql @@ -120,10 +120,6 @@ with ) {% for time_granularity in ["daily", "weekly", "monthly"] %} - {% if time_granularity != "daily" %} - union all - {% endif %} - select d.date, '{{ time_granularity }}' as time_granularity, @@ -145,4 +141,8 @@ with {% if time_granularity == "weekly" %} where d.is_end_of_week {% elif time_granularity == "monthly" %} where d.is_end_of_month {% endif %} + + {% if not loop.last %} + union all + {% endif %} {% endfor %}