Create a new formula.
After creating the formula, associate it to a specific dataset (Securable).
Note: during creation of formula, expressions will be validated. You can also validate the expression before creation using the validate action.
We support following functions in expression:
AVG({<dataset_ID>:<column_ID>})
COUNT({<dataset_ID>:<column_ID>})
COUNTD({<dataset_ID>:<column_ID>})
COUNTR()
MAX({<dataset_ID>:<column_ID>})
MIN({<dataset_ID>:<column_ID>})
SUM({<dataset_ID>:<column_ID>})
Derived column expressions can be combined with these aggregators. See this Academy article for the available operators.
Use GROUPFULL(aggregation) to ignore chart dimensions (filters still apply). Use GROUPINEX(aggregation, [columns to group by], [columns to exclude]) to include or exclude grouping columns. Nested aggregations wrap an inner grouped aggregation, for example AVG(GROUPINEX(SUM(...), [{<dataset_ID>:<column_ID>}], [])) . See Aggregation formulas .
Example:
"expression": "COUNTD({<orders_dataset_id>:<order_id_column_id>}) / COUNTD({<orders_dataset_id>:<store_id_column_id>})" Filtering formula results: When querying data, use a having filter to keep groups whose calculated formula result meets a condition, such as a rate above a target or a score below a threshold. These filters apply after aggregation and grouping. See Having filters .
A formula created by an embed token of a tenant is assigned to that tenant automatically. This requires use on the dataset through the token's tenant_fields_rights (or rights , if tenant_fields_rights is not set). See Custom fields per tenant .
npm install @luzmo/nodejs-sdk{
"count": 1,
"rows": [
{
"created_at": "2024-05-20T12:44:23.163Z",
"currency_id": null,
"description": {
"en": "Unique orders divided by stores represented in the selected data"
},
"ai_context": null,
"expression": "COUNTD({<orders_dataset_id>:<order_id_column_id>}) / COUNTD({<orders_dataset_id>:<store_id_column_id>})",
"format": ",.2af",
"id": "a1ad615a-5199-4e58-8e0e-73dceba18af0",
"informat": "numeric",
"lowestLevel": 0,
"name": {
"en": "Orders per active store"
},
"subtype": null,
"type": "numeric",
"updated_at": "2024-05-20T13:29:37.273Z",
"custom_metadata": null,
"user_id": "34b22f36-4904-497f-8acf-b0ba1d7e83cb"
}
]
}