Use cases

Advanced reporting

Create reports with multiple metrics.


Custom reporting

Build reports with custom metrics.


Features

All the common API features, plus:

Example

Example 1: Simple metric report query

Get the total taco sales for the last 30 days, grouped by restaurant name and taco name, and count distinct orders.

Usage

Arguments

The fields for querying a Metric Report.

A Metric Report is a table whose columns include dimensions and Metric values, calculated over a given time range.

timeRange
TimeRangeInput

The time range for calculating the Metric Report.

timeZone
String

The time zone to use. Dates and times are always returned in UTC, but setting the time zone influences relative time ranges and granularities.

You can set this to “America/Los_Angeles”, “Europe/Berlin”, or any other value in the IANA time zone database. Defaults to “UTC”.

dimensions
[MetricReportDimensionInput!]
required

One or many dimensions to group the Metric values by. Typically, dimensions in a report are what you want to compare and rank.

metrics
[MetricReportMetricInput!]
required

One or more Metrics to include in the Metric Report. These will be broken down by dimensions.

filterSql
String

The Query Filters to apply when building the Metric Report, in the form of SQL. These can be used to filter out rows.

orderByColumn
Int

The index of the column to order the Metric Report by. The index is 1-based and defaults to the first Metric column. In other words, by default, reports are ordered by the first Metric; however, you can order by the second Metric, third Metric, etc., by overriding the orderByColumn input. You can also order by dimensions this way.

first
Int

The number of rows to be returned when paging forward. It can be a number between 1 and 1,000.

after
String

The cursor to use when paging forward.

last
Int

The number of rows to be returned when paging forward. It can be a number between 1 and 1,000.

before
String

The cursor to use when paging backward.

Response

The Metric Report node object.

This type represents a single row of a report.

headers
[String]
required

An ordered array of display names for your dimensions and Metrics, as defined in the report input. Use this to display your table’s header.

row
[String]
required

An ordered array of columns. Each column contains the dimension and Metric values for a single row, as defined in the report input. Use this to display a single row within your table.