Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
juleshartley
Specialist
Specialist

Remove outliers from Average / Top bottom N

Hi Qlikers!

i have data similar to this:

       

KeyDateValue
101/01/20015
102/01/20015x
103/01/20010x
104/01/200110
105/01/200110x
106/01/200115x
201/01/200120
202/01/200120
203/01/20010x
204/01/200115x
205/01/200120x
206/01/200125x

And I'd like to get an avg per day, by Key but excluding the bottom 2 (and top 2) from the average- ie. where the x's are marked above.

The results would, therefore, be:

  

KeyAvg
17.5
220

I've considered, Rank, FirstSortedValue etc. but not sure how to implement. Any ideas!

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Try this

=Avg(Aggr(If(Num(Rank(Value, 4, 0)) > 2 and Num(Rank(-Value, 4, 0)) > 2, Value), Key, Date))


Capture.PNG

View solution in original post

2 Replies
sunny_talwar

Try this

=Avg(Aggr(If(Num(Rank(Value, 4, 0)) > 2 and Num(Rank(-Value, 4, 0)) > 2, Value), Key, Date))


Capture.PNG

juleshartley
Specialist
Specialist
Author

Sunny, you're a star!