Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculate adjusted mean by excluding extreme values

I have a set of response data in this format:

Student ID     School Q01     Q02     Q03 .......

10000001           A        5         4          3

10000002           A       3         3          1

10000003            B      4          5          5

10000004            B       4          3         4

10000005            C        3         2          5

10000006            C        5         3          4

The response data set are data collected from over 50000 students from different schools. They were asked to give 1 to 5 points to a number of questions (i.e. Q1, Q2, etc). By using Qlikview for analysis, we want to compile a table like this

School     Mean of Q1     Mean of Q2     Mean of Q3......

A               XX               XX                    XX

B               XX               XX                    XX

C               XX               XX                    XX

Instead of calculating the normal mean using Avg(), we would like to exclude some extreme cases before calculation. The design is for each question, we exclude the top 5 and bottom 5 responses, and then we calculate the mean of the remaining responses. Thus for a question with the following responses:

[1, 1, 1,1, 2, 2, 2, 2, 2, 3,3,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,5,5]

The bottom 5 (i.e. 1,1,1,1,2 ) and top 5 (5,5,5,5,5) will be excluded and the rest are used for calculating the mean.

I tried to implement this in QV using rank() and firstsortedvalue() but neither of them work. I can't find a way to sort the responses (which most likely contain duplicate values) and then get rid of / exclude those top and bottom 5 responses. Can anyone shed some light on that?

Thanks in advance.

0 Replies