Operation like sum, average, minimum and maximum of a set of data points is required while building a dashboard. This is one of the most common use case when you want to build a dashboard.
For example, we have sample dataset of orders placed on a hypothetical ecommerce store. This dataset has the following fields.
|saleSource||String (Possible values: ONLINE, OFFLINE)|
|status||String (Possible values: ON_HOLD, CONFIRMED)|
Let's say we want to find the maximum value of a column. To create this GraphQL query first pick the root query
q. All the analytics queries in dingoql starts with
Then we have to pick the table, in three steps.
We do this for every analytics query we want to execute in dingoql.
Now we can create a
SUM query by setting the input field
metric as follows (Please feel free experiment with live GraphQL query editor below.)
The response can be found in the
Similarily we can execute min operator as well.
In some cases we might want to apply a distinct operation on a column of a dataset while we are doing an aggregate operation. For example, let's set we want to answer the questions, how many possible states are there for an order? We can answer this by using
distinct operator as follows
Aggregate query result is can be found
jsonData field in a key which follows the follows the pattern
<OPERATOR_NAME>_<FIELD_NAME>. If you wish to rename this then it can be done by providing an alias field as follows