Segmentation lets you analyze the data with
dimension pairs. You select a dataset using
dataset property and specify the measures and dimensions under the dataset as part of the request, and an SQL query is generated depending on the field definitions. You can also
filter the data using field references.
Here is an example dataset:
version: 2sources:- name: first_datasettables:- name: usersmeta:metriql:total_users:aggregation: countcolumns:- name: country- nps:metriql.measure:- average
You can query the data using as follows:
The metriql queries above compile to the following query when you use the REST API SQL or JDBC API:
with top_users_by_country AS (SELECT country, count(*) FROM users HAVING avg(nps) > 10 GROUP BY country)select * from top_users_by_country
If you have event_timestamp mapping, the dataset will be marked as time-series data.