Wednesday, 26 July 2023

SQL - LEAD & LAG

 select date_trunc('month', timestamp) as date,

       count(*) as count,

       100 * (count(*) - lag(count(*), 1) over (order by timestamp)) / lag(count(*), 1) over (order by timestamp)) || '%' as growth

from events

where event_name = 'created chart'

group by 1

order by 1

DBT - Models

Models are where your developers spend most of their time within a dbt environment. Models are primarily written as a select statement and ...