An analytical expression is a formula expression language that is used to perform advanced calculations in direct query models, cached models, cached datasets, and dashboards. These expressions consist of functions, operators, and value references, which are evaluated as a formula to generate results. In simpler words, analytical expressions help you create new data from the existing data in the data models and datasets.
Usually, the data you want to visualize is readily available in the datasets and data models (as table columns) themselves. However, there can be scenarios where you might need to perform certain calculations on the data for deeper insights.
For example, have a look at the below table in which a new calculated column is added to show the COGS (Cost of Goods Sales) for each product. The calculated column (COGS) uses the following analytical expression -
COGS = 'FactSales'[SalesAmount] * 'FactSales'[UnitPrice]
This article provides an introduction to the common concepts of analytical expressions.
A model calculation for adding fields to the target table using analytical expressions. The expression must return a scalar value and is calculated for each row in the table. A calculated column is often used in arithmetic operations or string processing.
A model calculation for adding fields to the target table using analytical expressions, which calculates aggregation operations on multiple rows of the table according to the context. The measure is often used to calculate total, count, average, percentage, etc. according to the different dimensions.
A model calculation for generating a table by writing an analytical expression. Currently, the Wyn dashboard automatically generates a complete calculation table based on the user input for querying data.
It describes the environment in which an analytical expression is evaluated. It consists of dimension context and filter context.
The dimension context can be understood as sending the dimension to the analytical expression. The filter context can be understood as filtering the data of the original table of analytical expression.
It is a unit of analytical expression logic that evaluates and returns a result. Expression is constructed by using model objects (tables, columns, or measures), functions, operators, or constants.
It contains one or more arguments that allow passing input parameters. The name of the function must be followed by a parenthesis in which the parameters are passed. A function can include multiple function calls as well as nested functions.