Template Variable Support in Analysis Notebooks

Overview

Template variables let you dynamically filter and update results across multiple cells in a notebook. Many notebook cell types fully support template variables. This guide focuses specifically on analysis cells, where template variable support can vary.

Most analysis cells support template variables, but some have limited or no support. The sections below summarize where template variables work, how they behave, and where to expect limitations.

Quick reference

Cell typetemplate variable supportNotes
Data sourceCell name not supported.
TransformationCell name not supported.
VisualizationAll visualization types supported (scatterplot requires extra fields).
SQL AnalysisNot supportedNot supported.
Published dataset (reused elsewhere)Limited supportTemplate variables are resolved at publish time, you must republish to update downstream.

Support widgets

For all supported widgets, results update dynamically when template variables change, are renamed, or deleted.

Data source

  • Supported in query inputs.
  • All data sources are supported.
  • Template variables cannot be used in the name of the data source.

Transformation

  • Supported only in Filter operations.
  • Multiple filter operations can reference different template variables.
  • Template variables cannot be used in the name of a transformation.
  • Filter operations are used to calculate the usages of template variables in the template variable edit modal. Each filter operation counts towards the total number of potential usages.

Visualization

  • Supported in cell titles, filters, and analysis queries.
  • All visualization types are supported.
  • Filters remain consistent when switching visualization types, except scatter plots (which require additional setup).

Note: Visualizations with published datasets behave the same as standard visualizations, and their results update when template variables change in the source notebook.

Limited support widgets

SQL analysis

  • Not supported.
  • Template variables cannot be used in SQL queries.
  • Not included in template variable usage counts and unaffected by Add all / Remove all operations.

Published datasets

When you export a query to a dashboard, Datadog creates a published dataset. A published dataset can be referenced as a data source in other dashboards or notebooks.

If the source query uses template variables, their values are interpolated at the moment of publishing. This means:

  • Template variables are resolved to their current values when the dataset is published.
  • If those values later change in the source notebook, you must republish the dataset to apply the update.
  • Published datasets can be used in contexts where template variables are not available (for example, monitors or dashboards without matching template variable names).

Further reading

Additional helpful documentation, links, and articles: