Calculated Datasets
How to create dashboard-level calculated datasets to transform and combine workflow data.
Calculated datasets let you create additional data transformations directly within a dashboard, without modifying the underlying workflows. They can combine, reshape, and enrich data from your workflow queries.
Why use calculated datasets
Calculated datasets are useful when you need dashboard-specific transformations that don't belong in the workflow itself:
- Combine data from multiple workflows - join or union results from different workflow queries into a single dataset
- Reshape data for specific widgets - pivot or unpivot data to match the format a chart or table needs
- Add dashboard-specific calculations - create computed columns, aggregations, or filters that only apply to this dashboard
- Iterate quickly - test transformations instantly without re-publishing workflows
Because calculated datasets are lightweight and run instantly, they are ideal for transformations on data that workflows have already prepared. For heavy processing on large datasets, keep the work in workflows where it benefits from the full power of your data source.
Creating calculated datasets
- Open a dashboard in the builder
- Navigate to the calculated datasets editor
- Create a new calculated dataset and give it a name
- Write SQL or JavaScript in the notebook-style cell editor
- Run the cells to preview results
Calculated datasets use the same notebook-style cell editor as workflows, with both code and text cells. You can use Ctrl+I (or Cmd+I on Mac) to open the AI assistant, which can help you write SQL or JavaScript.
Writing SQL
Calculated datasets use SQL to query and transform data. You reference workflow query results by their query name:
-- Reference a workflow query called "sales_by_region"
SELECT region, SUM(revenue) as total_revenue
FROM sales_by_region
WHERE year = 2024
GROUP BY regionYou can join data from multiple workflow queries:
SELECT s.region, s.revenue, t.target
FROM sales_by_region s
JOIN regional_targets t ON s.region = t.regionCalculated datasets can also reference other calculated datasets, allowing you to build multi-step transformations within the dashboard.
Writing JavaScript
In addition to SQL, you can use JavaScript cells for transformations that are difficult to express in SQL. JavaScript cells can access the results of previous cells and source datasets.
Pivot and unpivot
The editor provides built-in tools for common data reshaping operations:
Pivot
Convert long-format data into wide format. For example, turn rows of monthly values into columns:
| Region | Month | Revenue |
|---|---|---|
| North | Jan | 100 |
| North | Feb | 150 |
Becomes:
| Region | Jan | Feb |
|---|---|---|
| North | 100 | 150 |
When pivoting, you choose:
- Group by columns - the row identifiers to keep (e.g., Region)
- Pivot column - the dimension to spread into columns (e.g., Month)
- Value column - the data to aggregate (e.g., Revenue)
- Aggregation - how to summarize values (sum, count, average, min, max)
Unpivot
Convert wide-format data back into long format - the reverse of pivot. You select which columns to preserve as row identifiers and which to collapse into key-value pairs.
Organization
Calculated datasets can be organized into folders within the dashboard, just like queries in a workflow. You can also clone, rename, enable, or disable individual datasets.
Using calculated datasets in widgets
Once created, calculated datasets appear alongside workflow queries when configuring widgets. You can bind any widget (map, chart, table, metric, slicer) to a calculated dataset just as you would to a workflow query.
Calculated datasets vs. workflow queries
| Calculated datasets | Workflow queries | |
|---|---|---|
| Performance | Instant, lightweight | Full database power for large datasets |
| Scope | Single dashboard | Reusable across dashboards |
| Languages | SQL and JavaScript | SQL |
| Best for | Lightweight reshaping, joins, dashboard-specific calculations | Heavy data processing, large datasets, shared data pipelines |
| Iteration speed | Instant - runs locally | Requires workflow publish cycle |