Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jmonroe918
Creator II
Creator II

Average Age Calculation in Text Box

I am trying to calculate the average age of 'open' and "on-hold" records in a data set (see attached spreadsheet) and display in a text box.

The expression I am using is this:

=AVG(Aggr(sum({<Iss_Status = {'Open', 'On-Hold'}>}Iss_Age),Iss_Age))

The result I am getting s 239.83333 and it should be 195 (per the spreadsheet).

What am I doing wrong in the formula?

Thanks.

Jeff

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

=AVG({<Iss_Status = {'Open', 'On-Hold'}>} Aggr(sum({<Iss_Status = {'Open', 'On-Hold'}>}Iss_Age),Iss_Age))


edit:

No, this should be correct:

=AVG(Aggr(sum({<Iss_Status = {'Open', 'On-Hold'}>}Iss_Age),Issue_ID))

View solution in original post

7 Replies
swuehl
MVP
MVP

Try

=AVG({<Iss_Status = {'Open', 'On-Hold'}>} Aggr(sum({<Iss_Status = {'Open', 'On-Hold'}>}Iss_Age),Iss_Age))


edit:

No, this should be correct:

=AVG(Aggr(sum({<Iss_Status = {'Open', 'On-Hold'}>}Iss_Age),Issue_ID))

Not applicable

display the aggregate total of the number of days as well as the number of rows in the qlikView application - that will tell you how it is cvalculating

pamaxeed
Partner - Creator III
Partner - Creator III

Just do: =Avg({<Iss_Status = {'Open', 'On-Hold'}>}Iss_Age)

Not applicable

Excell is aggregating a value of 7232 and dividing by 37 (the number of open and on-hold)

verifying in Qlik will tell you how Qlik is coming up with average

Not applicable

I also do not believe you need to do an Aggr if you are using the average function - you would only need the aggr function for example if you were going to calcualte the average yoursel you would aggregate and then divide the aggregate by the number of entries

The avg function does that for you

maxgro
MVP
MVP

=AVG(Aggr(sum({<Iss_Status = {'Open', 'On-Hold'}>}Iss_Age),Issue_ID))

1.png

Not applicable

Try one of the two options.