Median() returns
the aggregated median of the values in the expression over a number of records as defined by a
group by clause.
Syntax:
Median (expr)
Return data type: numeric
Arguments:
Arguments
Argument
Description
expr
The expression or field containing the data to be measured.
Example: Script expression using Median
Load script
Load the following inline data and script expression in the data load editor for this example.
Table 1:
Load RecNo() as RowNo, Letter, Number Inline
[Letter, Number
A,1
A,3
A,4
A,9
B,2
B,8
B,9];
Median:
LOAD Letter,
Median(Number) as MyMedian
Resident Table1 Group By Letter;
For more information about using inline loads, see Inline loads.
Create a visualization
Create a table visualization in a Qlik Sense sheet with Letter and MyMedian as dimensions.
Result
Explanation
The median is considered the "middle" number when the numbers have been sorted in order from smallest to greatest. If the data set has an even number of values, the function returns the average of the two middle values. In this example, the median is calculated for each set of values of A and B, which is 3.5 and 8, respectively.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!