Asana model

Project overview

One row per project: status, owner, team, task progress and overdue work. Recreates the overview Asana shows on a portfolio, as of the last sync.

Grain
project
Built from
  1. 5
    Raw tables
  2. 5
    Staging
  3. 1
    Core
  4. 1
    Analytics
Reads from Asana
projectproject_tasktaskteamuser
Ships as
Weld and dbt SQL, open source on GitHub
core.asana.project_overview
1-- core.asana.project_overview
2-- One row per project: status, owner, team, task progress and overdue work.
3-- Recreates the overview Asana shows on a portfolio, as of the last sync.
4-- Grain: project.
5--
6-- Task counts only include assigned tasks, because unassigned tasks are not
7-- synced (see staging.asana.task). `pct_complete` is therefore the share of
8-- assigned tasks that are done, which can differ from Asana's own progress bar.
9-- Overdue uses the due time when one is set and the due date otherwise, as in
10-- open_task_workload.
11
12WITH task_stats AS (
13    SELECT
14        pt.project_id,
15        COUNT(*)                                                    AS tasks,
16        COUNTIF(t.is_completed)                                     AS completed_tasks,
17        COUNTIF(NOT t.is_completed)                                 AS open_tasks,
18        COUNTIF(NOT t.is_completed
19                AND IF(t.due_at IS NOT NULL, t.due_at < CURRENT_TIMESTAMP(), t.due_on < CURRENT_DATE()))
20                                                                    AS overdue_tasks,
21        COUNT(DISTINCT IF(NOT t.is_completed, t.assignee_id, NULL)) AS assignees_with_open_tasks,
22        MAX(t.completed_at)                                         AS last_completed_at,
23        MAX(t.modified_at)                                          AS last_task_modified_at
24    FROM {{staging.asana.project_task}} pt
25    JOIN {{staging.asana.task}} t USING (task_id)
26    GROUP BY 1
27)
28
29SELECT
30    p.project_id,
31    p.project_name,
32    p.workspace_id,
33    p.team_id,
34    tm.team_name,
35    p.owner_id,
36    o.user_name                                   AS owner_name,
37    p.is_archived,
38    p.current_status_color,
39    p.created_at,
40    p.due_date,

This model and the 6 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().

Notes

How it counts. And where it stops.

Task counts only include assigned tasks, because unassigned tasks are not synced (see staging.asana.task). `pct_complete` is therefore the share of assigned tasks that are done, which can differ from Asana's own progress bar. Overdue uses the due time when one is set and the due date otherwise, as in open_task_workload.

Raw tables it reads

  • raw.asana.project
  • raw.asana.project_task
  • raw.asana.task
  • raw.asana.team
  • raw.asana.user

Put Asana in front
of your agents.

Connect Asana, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.