# QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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
Employee

## Re: Reference line of Average of top 10 sales days

Use this expression:

=avg(aggr(

if(

rank(sum(Sales)) <= 10,

sum(Sales)

),SalesDate)

)

3 Replies
Employee

## Re: Reference line of Average of top 10 sales days

Use this expression:

=avg(aggr(

if(

rank(sum(Sales)) <= 10,

sum(Sales)

),SalesDate)

)

Not applicable

## Re: Reference line of Average of top 10 sales days

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?

Employee

## Re: Reference line of Average of top 10 sales days

Maybe this?

=avg(aggr(

if(

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

sum(Sales)

),SalesDate)

)