How to calculate the average for the top 85% of your data

I have data that has columns: id, time_to_schedule ( this is difference between when a job was created to scheduled , already calculated in the dataset , calculated in days) .
In quicksight I have filter to filter on a specific customer name or all .
The existing view does an average of all the entries , but , I want to perform the aggregation for only the top 85% of data . I tried percentile functions but is not working.
Any help would be much appreciated.

2 Likes

Hello @samp , welcome to the Quicksight community!

Could you try this calculation:
avg(ifelse(percentileRank([max({time_to_schedule}) DESC], [{id}]) <= 85, {time_to_schedule}, NULL))

2 Likes

Thanks for the reply, this worked for me - avgIf({total_speed_of_repair}, {total_speed_of_repair}<=percentileDiscOver({total_speed_of_repair}, 85,, PRE_AGG))

1 Like