Transformations
Transformations process the result of the inner sources before it is passed to the dataset or to the next transformation.
"dataset": {
"type": "transformation-1",
// Transformations always take a list of sources
// Even if only one is used
"sources": [
{
// Transformations can be chained
"type": "transformation-2"
"sources": [
{
// End the end we have one more
// query data sources
"type": "OTQL"
...
}
]
}
]
}to-list
to-listThis puts multiple numbers from multiple queries into a key / value dataset. It is important to set the key of each number with the series_title property. It takes from one to any number of sources.
join
joinThis joins two key / value datasets into a key / values dataset. It is important to set the name of each series with the series_title property. It takes from one to any number of sources.
to-percentages
to-percentagesThis calculates the representation of each value in the complete dataset. Only one sources is accepted.
You usually want to use the format: percentage option of the associated data visualisation to automatically change the labels and tooltips and formats to display percentage% (count)
ratio
ratioThis calculates the ratio between two numbers (source 1 / source 2 * 100). It only accepts two sources that should each return numbers.
index
indexThis calculates the representation of values from a key / value dataset in comparison to an other key / value dataset.
For example, if 10% of the users in a segment viewed content associated with tag 1, while 5% of the users in the whole datamart viewed content associated with this same tag, the index of tag 1 in segment in comparison to the whole datamart is 10 / 5 * 100 = 200.
This is typically used to see which values are more/less represented in the first data source compared to the second one. An index above 100 means the value is more represented in the first data source than in the second, a value under 100 means the value is less represented in the first data source than in the second.
This is usually represented in a Bars chart with a plot_line_value of 100 and an index format :

For each value in the first dataset, it automatically calculates its percentage representation in the first and the second source, then does the formula source value (in percentages) / comparison value (in percentages) * 100 .
format-dates
format-datesThis formats timestamps and date fields to the specified date format. Available date formats are Moment.js date formats.
Use this transformation to allow the display of friendly dates to the user or to allow joining multiple data sources into the same dataset by putting returning dates in the same format.
Dates must be in the 2021-11-05T00:00:00.000Z format or in timestamp to be formatted.
Typical compatible queries are :
OTQL queries returning timestamps or @date_histogram.
Activities analytics queries returning the date_time dimension
Collection volumes queries returning the date_time dimension.
reduce
reduceThis transforms a key / value or key / values dataset into a single number to be displayed in Metric charts.
avgcalculates the average of valuescountcalculates the number of valuesfirstreturns the first valuelastreturns the last valuemaxreturns the maximum valueminreturns the minimum valuesumreturns the sum of all values
get-decorators
get-decoratorsThis transforms identifiers such as channel IDs, compartment IDs and segment IDs into the corresponding channel names, compartment names and segment names.
Last updated
Was this helpful?