Metrics
Within Inzata, a Fact is a set of column values in your data set. A single value of fact represents the most granular level of your transactional data, an individual data field at the intersection of a row and a column in a table. Think of a single value of Fact as analogous to a single cell in a spreadsheet containing an integer or text.
Facts alone are often not of great value for reporting. However, multiple Facts that are added, summed, or averaged together, can be of great value.
Inzata uses the concept of Metrics to accommodate this. A Metric is a value that is calculated from one or more Facts. In addition to the Metrics Inzata automatically generates from a dataset, Inzata gives you the ability to create custom Metrics that are stored as objects in the Metrics repository. These Metrics can then be shared across an organization and with many users to produce more complex reporting and analysis.
Inzata also supports the creation of new Metrics built using existing Metrics. In this way, more complex metrics can be built from simpler ones, and changed as required.
To create a new metric click on metrics in the left menu and list of metrics is presented on the left panel. In that panel click on the “Create new metric” button . A new tab will appear.
The options a metric has can be seen by opening a new metric (or an existing metric then clicking edit from the application menu at the top of the screen) and then opening the “metric” option from the widget menu seen on the right side of your screen.
From top to bottom, the items and what they effect are:
- Name – This lets you set a name for your metric. This will be how it is displayed in the open tabs bar as well as within the list from the objects menu. This metric name can be changed at any time.
- Ident – This is how inzata will internally recognize the metric.
- Description – Can contain a brief description of metric.
In the tab on the left side there is the Expression Editor where you can define expression of metric.
On the right side there are panels that help you to define metric. There are following parts:
- functions
- parameters
- format
- operators
Functions
The table below summarizes all aggregate functions that are currently supported.
Function | Description |
MIN(x) | Finds the smallest value of x |
MAX(x) | Finds the largest value of x |
SUM(x) | Sums up values of x |
COUNT(x) | Counts a number of DISTINCT values in column x |
AVG(x) | Finds a average value of x across all input rows |
TOP(x, cnt) | define number of sorted rows for filtration |
BOTTOM(x, cnt) | define number of sorted rows for filtration |
Parameters
The table below summarizes all available parameters
Parameter | Description |
DICE | Defines the aggregation behavior of a metric. |
SLICE | Defines the filtering behavior of a metric. |
IGNORE | Depending on the context where it is used, the IGNORE prevents the metric from aggregating (or filtering) data by attribute1 and attribute2 as well as by any other attribute which can be derived from the two. |
ALLOW | Depending on the context where it is used, the ALLOW clause makes it possible to aggregate (or filter) the metric by attribute1 and attribute2 as well as by any other attribute which can be derived from the two. |
ALL | The ALL represents all attributes. It can be used in the IGNORE as well as in the ALLOW clauses. |
OTHER | The OTHER represents all attributes not explicitly mentioned in the IGNORE or ALLOW clauses. |
Format
Here you can define the format of a metric. Available Types are Number, Date and Duration. Following sections are:
- Syntax settings – it is dependent on selected Type and is used to define data format, for example number of decimals for numbers or date format.
- Prefix/Suffix settings – you can define for example $ as prefix or % as suffix.
- Icon settings – you can define the icon that is displayed in front of value.
Example
For example let’s say you have metrics “# Customer_id“ (which calculates the number of customers) and “Sum Transaction_Total“ and you will create a metric that calculates “Transaction_Total per Customer“.
Click on metrics in the left menu and list of metrics is presented on the left panel. In that panel click on the “Create new metric” button . A new tab will appear. If the Metric Property panel is hidden, click on the metric in the right menu. You should enter the following values into it:
- Name – Transaction_Total per Customer
- Ident – m_transaction_total_per_customer
- Description – Calculates a Transaction_Total per Customer as a fraction of Sum Transaction_Total / # Customer_id from line items
Now define metric expression. Drag SUM from functions panel, drag the $ Base Price measure from the Metrics panel and drop it after the “SUM(“, then type “ / “, then append the # Quantity metric between “ / “ and “)”.
Please note that all algebraic operations must be enclosed in an aggregate function. This means that if you want to multiply the measure m_am_Retail_Price by 0.5, you have to use a formula SUM(m_am_Retail_Price * 0.5) rather than just m_am_Retail_Price * 0.5.
Now define the format of the result value on the format panel. Select Number Type and choose Syntax settings. Type “2“ into Decimal places and check separator of thousands.
Now you can validate the expression by clicking on “Validate AQL”. Provided it is correct, you will receive the message “Syntax: Valid: OK”, as shown in the following picture.
Now click on the “Save” button in appBar to save the measure. Close the tab.