Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue with Averages

Hi, I'm having issues with my average calculation using time and volumes

Time                             Volumes

01:00:00                           4

01:00:00                           3

01:00:00                           2

01:00:00                           4

01:00:00                           5

03:30:00                           2

03:30:00                           2

03:30:00                           3

03:30:00                           4

=Sum(VOLUME) / Count( [Time])

For 01:00 I would want to return an average of 3.6

For 03:30 I want to return an average of 2.75

The issue seems to be with the count section of my expression, it's counting the total value of time instead of the entries.

7 Replies
Anil_Babu_Samineni

Just do Avg(Volumes)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

I've added the above expression to my pivot table but it's still not showing me the correct average.

It's seem to be trying to count the value of my time instead of the amount of entries for that specific time

vinieme12
Champion III
Champion III

read this post

Average – Which average?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

try with the TOTAL keyword

either

=Sum(VOLUME) / Count( TOTAL [Time])


or


Sum(VOLUME) / Count( TOTAL <[Time]> [Time])

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

Try this in front end

aggr(Avg(Volumes),Time) 

Anil_Babu_Samineni

Why not?

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
masismykola
Partner - Contributor III
Partner - Contributor III

Hi in script it would be like:

temp:

LOAD * INLINE [

Time,Volumes

01:00:00,4

01:00:00,3

01:00:00,2

01:00:00,4

01:00:00,5

03:30:00,2

03:30:00,2

03:30:00,3

03:30:00,4

];

NoConcatenate

table:

load

Time,

avg(Volumes) as AvgByTime

Resident temp

Group by Time;

drop table temp;