Skip to main content

Saved Queries

Saved queries are a way to save commonly used queries in MetricFlow. You can group metrics, dimensions and filters that are logically related into a saved query. The spec for defining a saved query is below:

ParameterDescriptionType
nameThe name of the metric.Required
descriptionThe description of the metric.Optional
metricsThe metrics included in the saved query.Required
group_bysThe value that will be displayed in downstream tools.Required
whereFilter applied to the query.Optional

An example of a saved query is below:

saved_query:
name: p0_booking
description: Booking-related metrics that are of the highest priority.
metrics:
- bookings
- instant_bookings
group_bys:
- TimeDimension('metric_time', 'day')
- Dimension('listing__capacity_latest')
where:
- "{{ Dimension('listing__capacity_latest') }} > 3"

FAQs and Usage Notes:

  • Dimensions refrenced in the group by or where must be common across all metrics in a saved query.
0