| title | Calculated fields |
|---|---|
| description | Create ad-hoc measures and dimensions at query time in Workbooks and Explore without modifying your data model. |
Calculated fields let you define new measures and dimensions on the fly while exploring data in Workbooks and Explore. They are scoped to the current query and do not alter your data model, so you can experiment with new metrics without a deployment cycle.
Calculated fields are currently available as query-level fields in Semantic Query tabs and Explore. Support for additional field types is planned for a future release.
Use calculated fields when you need to:
- Compute a ratio, percentage, or difference between existing measures
- Derive a new dimension from existing dimensions (for example, concatenating first and last name)
- Test a metric definition before adding it to the data model
- Create one-off calculations for a specific analysis without involving a data engineer
If you find yourself reusing a calculated field across multiple workbooks, consider promoting it to a calculated measure or dimension in the data model so it can be governed, reused, and pre-aggregated.
In a workbook, open an existing Semantic Query tab or create a new one. You can also start from the **Explore** page. In the left pane, click the **+** button next to the measures or dimensions section and select **Calculated field**. Enter a SQL expression that references existing measures or dimensions from the current view. For example, to calculate a completion rate:```sql
1.0 * completed_count / count
```
You can use standard SQL functions and operators supported by your data
source.
Calculated field expressions use SQL syntax. You can reference any measure or dimension available in the current semantic view by name.
| Operation | Example |
|---|---|
| Arithmetic | revenue - cost |
| Division with decimals | 1.0 * completed_count / total_count |
| String concatenation | first_name || ' ' || last_name |
| Conditional logic | CASE WHEN status = 'active' THEN 1 ELSE 0 END |
| SQL functions | ROUND(revenue / orders, 2) |
Available SQL functions depend on your connected data source. For example,
CONCAT() works in most databases, but string concatenation with || may
not be supported in all of them.
Calculated fields are scoped to the individual query where they are created. They are:
- Not saved to the data model — they exist only within the workbook tab or Explore session where you created them
- Saved with the workbook — if you save or publish the workbook, your calculated fields are preserved in that workbook
- Not available in other workbooks — to share a metric across workbooks, add it to the data model as a calculated measure
- Calculated fields are available in Semantic Query tabs and Explore only, not in Source SQL tabs
- Pre-aggregations do not apply to calculated fields since they are not part of the data model
- Access control policies defined in the data model do not apply to calculated field expressions directly, though the underlying measures and dimensions they reference still respect access control
- Calculated measures and dimensions for defining reusable calculations in the data model
- Querying data for working with Semantic Query tabs
- Explore for ad-hoc data exploration