Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Highlighted
michael_andrews
New Contributor III

Average a Sum of Child Records

I need to average the sum of individusal sets of records. The example would be we have a page showing exam totals. I.e. exam1's max score, min score, average score, etc. It's broken up by exam. Now, there are multiple people who can take exam 1, so each exam taken record would have Multiple ItemTimeSpent Records. It's basically a record for the amount of time spent per question, per exam taken, per unique exam

However, each exam will have multiple ItemTimeSpent records. Basically, I need to sum them per exam, and then

average that sum.

So, if exam1 had time spent of

Exam1 - Record 1

10

20

10

15

25

20

Total 100

Exam1 - Record 2

10

10

10

15

15

10

Total 70

Our output would only have one column for exam1, with the previous stats I mentioned, but I'd also like to add in and average time spent columnn, that would basically sum ItemTimeSpent, then average each sum, per exam taken, in this case it would average 100 and 70, giving me 85 as one row under exam1

I'm not quite clear how I get it to sum all the items, grouped by each exam taken, and then average that. I've tried this but it's not working

AVG(Sum(ItemTimeSpent) / 60)

Tags (1)
1 Solution

Accepted Solutions

Re: Average a Sum of Child Records

May be this:

Avg(Aggr(Sum(ItemTimeSpent), Exam))

or this

Avg(Aggr(Sum(ItemTimeSpent)/60, Exam))

2 Replies

Re: Average a Sum of Child Records

May be this:

Avg(Aggr(Sum(ItemTimeSpent), Exam))

or this

Avg(Aggr(Sum(ItemTimeSpent)/60, Exam))

michael_andrews
New Contributor III

Re: Average a Sum of Child Records

Awesome, I believe your second answer is what I need, because I want it in minutes and the data is in seconds. Thanks!

Community Browser