Coding Challenge: Pack Your Macro
Complete this hands-on exercise to pack a macro inside a package and import it into your project.
We'll cover the following...
Problem
Here’s a macro that groups by a column and counts distinct values of a field:
Press + to interact
{% macro daily_count(field_to_count) %}SELECTorder_date,COUNT(DISTINCT {{field_to_count}} ) AS {{field_to_count}}FROM {{ ref("orders") }}GROUP BY order_date{% endmacro %}
As this macro is ...