{{getMsg('Help_YouAreHere')}}:
/
{{page.title}}
{{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}}
{{helpModel.downloadHelpPdfDataStatus}}
Median
Computes the median value of the specified numeric field or array. These are the median values in a numerical sequence (or the average of the two middle values in a straight sequence). The median is the value where there are the same number of lower values as there are higher ones.
It is also possible to specify a condition which records to include.
Usage:
Median( fld ) Median( fld, condFld ) Median( fld, condFld, cond )
Parameters:
fld | The name of a field or array variable whose values should be used to calculate the median value. |
---|---|
condFld | The name of the field that groups the values of fld (if fld isn't an array). |
cond | A string declaring the type of grouping to be used on condFld. This only makes sense for groups based on Date, DateTime, Time, and Boolean fields. See Summary Field Conditions for a list of strings you can use here. |
Returns:
A fractional number.
Examples:
//returns 4.5 because (3+6) / 2 = 4.5 median([2,6,3,9])
//returns the median value of the array median([2,5,3,2,9,6,4,3,2,5,7,8,5,1,3,6,4]) //returns 4 (lesser higher as lower number)
//returns the median value of the database field median({Sales.Sales_Amount})
//returns the median Sales_Amount grouped by Vendors median({Sales.Sales_Amount, Vendors.Vendor})
//a formula that depends on the median value of Sales_Amount numberVar middle = median({Sales.Sales_Amount}); if {Sales.Sales_Amount} > middle then red else black
Notes:
-
If the values in fld should be grouped, a group based on condFld is needed. If the group does not exist in the report, you can add it using i-net Designer or using API method: Engine.addGroup.