Solution: Daily Aggregation Macro
Get a detailed review of the solution to the “Daily Aggregation Macro” challenge.
We'll cover the following...
We'll cover the following...
Solution
Let’s review the solution to the problem.
{% macro daily_count(field_to_count) %}
SELECT
order_date,
COUNT(DISTINCT {{field_to_count}} ) AS {{field_to_count}}
FROM {{ ref("orders") }}
GROUP BY order_date
{% endmacro %}Solution code: Creating a daily_count macro
Code explanation
In the daily_count.sql file: ...