median
Learn more about the Cortex Query Language median function used with both comp and windowcomp stages.
Syntax
comp stage
comp median(<field>) [as <alias>] by <field_1>,<field_2> [addrawdata = true|false [as <target field>]]windowcomp stage
windowcomp median(<field>) [by <field> [,<field>,...]] [as <alias>] Description
The median() function is used to return the median value of a field over a group of rows. The function syntax and application is based on the preceding stage:
comp stage
When the median aggregation function is used with a comp stage, the function returns a single median value of a field for a group of rows, for all records that contain matching values for the fields identified in the by clause.
In addition, you can configure whether the raw data events are displayed by setting addrawdata to either true or false (default), which are used to configure the final comp results. When including raw data events in your query, the query runs for up to 50 fields that you define and displays up to 100 events.
windowcomp stage
When the median aggregate function is used with a windowcomp stage, the function returns a single median value of a field for each row in the group of rows, for all records that contain matching values for the fields identified in the by clause. In a median function, the sort and between window frame clause are not used. The results are provided in a new column in the results table.
Examples
Last updated
Was this helpful?
