Average
Executes average aggregation on a column of data from the model. The column needs to have numerical data for it to be functional.
- Returned Output: Numeric
- Library: PQL \ Granular \ Aggregate
- Version: 2018.00.000
- Compatibility: Pyramid Query Language (PQL) data sources
Syntax
Syntax Alternatives
* Click on the function's arguments above for more details on the input values.
Comments
- The "measure" column needs to be the name of the column in the model [table].[column name] or it can be an existing measure in the model [measures].[column name].
- For details on how to employ and use this function see the granular calculation overview.
Different Function types
- This function is like the SQL average function; calculating the average of a column of data in your query or model .
- If you wish to find the average for the elements in a specified SET or LIST from a hierarchy, use this semantic function.
- To use a simple average mathematical operation on a list of numbers, use the Common library function.
Examples
To create a new measure that is the Average of expenses in the model, using the sample demo model:
Average( [data].[Expenses] )
or:
Average( [measures].[data Expenses] )
The mechanics of this function are shown below. This grid says that the average expense across all 'Accessory' transactions is $40.97, which is 57k in total expenses divided by 1398 transactions (count). This produces a different result to the Average([LIST]) function (which, depending on formulation, would have taken the total 10,197,430 and divided by the 4 categories = 2,549,357).