SpinTheMic
Pro

Explain it in 60 seconds

Filling date gaps with a date spine

Data Engineering · SQL · Intermediate

Your daily sales report skips days with no sales. How do you show every day, including zeros?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Generate a complete list of dates, called a date spine or calendar table.
  • LEFT JOIN the sales aggregation onto the date spine.
  • COALESCE missing values to zero.
  • Generate dates with GENERATE_SERIES, GENERATOR or dbt_utils.date_spine.
  • A permanent calendar dimension is reusable.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics