Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating Averages in a chart


Hi all, Posted this earlier but wasnt very clear. I have to calculate an average but remove the last value by date i.e. 1/5/13 to the 1/6/13 so remove the value associated with the 1/6/13 and then calculate the average. This can happen mid month so it is always the latest value by date that is removed.

sum(Amount)/Count of Date less 1

Below is an example

01-May500500
02-May500500
03-May200200
04-May700700
05-May700700
06-May700700
07-May700700
08-May700700
09-May700
Actual average600587.5

Can someone tell me how I do this with Set analysis

I can get the count working but cant get the sum to work. Does anyone have any ideas?

Thanks

Alan

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

hi alan,

is it what you really like to have?

Regards,

View solution in original post

4 Replies
Not applicable
Author

Hello,

See the attach file, I think it can works.

Best regards.

Not applicable
Author

Thanks for your help, however the the first column of dates would be all that was in the QV the second column is an example of how i want to calculate the average. i.e I want to sum all but deduct the value with the corresponding latest date and then calculate the average. using a count - 1.

DateValue
01-May100
02-May150
03-May150
04-May150
05-May150
06-May150
07-May150
08-May150
09-May150
10-May200
11-May

200

Actual average154.55
Average I want150
To calculate
  the average after removing the last value (in yellow) via script.

The bold value related to 11-May needs to be ignored for average calculation.

Regards

Alan

Anonymous
Not applicable
Author

hi alan,

is it what you really like to have?

Regards,

Not applicable
Author


Thanks very much, not sure how it works but it does. Thanks for your help