<< Click to Display Table of Contents >> Create Aggregate Measure Expression |
![]() ![]() ![]() |
Aggregate expressions can also only be used as metrics. So when defining such expressions, it's best to use the data types that are commonly used for metrics: various numeric types. You can reference other fields in an expression, you can do four arithmetic operations, or you can use aggregate functions. For example, summing the sales fields, subtracting the sum of the product costs, returning the total profit, and binding this expression to the text or instrument component, you can get the total profit in real time. Only such expressions can be used in summary tables. If converted to a detail table, such expressions are automatically removed from the binding interface.
❖Create Aggregate Measure Expression
The creation method is similar to the creation of an expression. Unlike the new dimension expression, the SQL expression graying is not optional in the New Aggregate Expression dialog box.
➢E.g
Suppose there are three data segments, total sales (SALES), total cost (TOTAL_EXPENSES), and market (MARKET). When the user wants to calculate the total profit of each market, it can be realized by the aggregation expression. The content of the script is the difference after summing the two data segments, as shown in the following figure:
As shown in the following table, the total profit data segment is implemented by creating a new aggregate expression.