Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average of top 10 sales days

Hi guys,

I have two fields "Sales" and "SalesDate" in a chart.

The Dimension is "SalesDate" and the Expression is "Sum(Sales)".

I want to put a Reference Line for the Average Sales for the Top 10 SalesDates.

Can someone please assist me with this?

Kind Regards,

Werner !

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

Use this expression:

=avg(aggr(

  if(

  rank(sum(Sales)) <= 10,

  sum(Sales)

  ),SalesDate)

)

View solution in original post

3 Replies
Clever_Anjos
Employee
Employee

Use this expression:

=avg(aggr(

  if(

  rank(sum(Sales)) <= 10,

  sum(Sales)

  ),SalesDate)

)

Not applicable
Author

Hi Clever,

Thanks! That works perfectly.

If I wanted to take it a step further and only include the top sale days where the sales are more than 3000 sales?

Clever_Anjos
Employee
Employee

Maybe this?

=avg(aggr(

  if(

  rank(sum(Sales)) <= 10 and sum(Sales) > 3000,

  sum(Sales)

  ),SalesDate)

)