Overview
Syntax | MAX_AGG(Array) | According to the current analysis dimension, this function returns the maximum value of the field. The generated results are listed in a data column. The number of rows in the data column is consistent with that in the current analysis dimension. |
---|---|---|
Parameter | Array | The Array parameter must be the result returned by a non-aggregate function formula, which can be a calculation result of an indicator field, dimension or indicator field and a common formula. When the Array parameter is a non-numeric field, it can be used only in the DEF function. |
Notes
The function supports one parameter of any type for real-time data.
The function is only supported on the dashboard and not supported for self-service datasets.
Example
If the horizontal axis is the dimension field Day, the value returned by the calculation field MAX_AGG(Sales Volume) of the vertical axis is the maximum daily sales.
If the horizontal axis is the dimension field Month, the value returned by MAX_AGG (Sales Volume) is the maximum monthly sales.
Calculating the Maximum Time in the Current Dimension
You need to calculate the maximum time in the current dimension, for example, the maximum time in the monthly data in Contract Signing Time, as shown in the following figure.
Click , set Field Name to Maximum Time, and enter FORMAT(TODATE(MAX_AGG(DATETONUMBER(Contract Signing Time))),"YYYY-MM-dd HH:mm:ss"), as shown in the following figure.
The following table describes the formula.
Formula | Description |
---|---|
DATETONUMBER(Contract Signing Time) | Returns the number of milliseconds from January 1, 1970 00:00:00 GMT to the specified date. |
MAX_AGG(DATETONUMBER(Contract Signing Time)) | Returns the maximumnumber of milliseconds in the current dimension. (The returned value is of the numeric type.) |
TODATE(MAX_AGG(DATETONUMBER(Contract Signing Time))) | Converts the maximum number of milliseconds in the current dimension to a specified date. |
FORMAT(TODATE(MAX_AGG(DATETONUMBER(Contract Signing Time))),"yyyy-MM-dd hh:mm:ss") | Converts the maximum date (the value returned by TODATE(MAX_AGG(DATETONUMBER(Contract Signing Time)))) in the current dimension to the format yyyy-MM-dd hh:mm:ss. |
Drag the Contract Signing Time field into the horizontal axis, group the field by Year-Month, and drag Maximum Time into the horizontal axis, as shown in the following figure.