Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
dukane24
Contributor III
Contributor III

Calculate a sum of distinct averages

Hello!

I'm trying to write an expression and I'm thinking there must be an easier way to accomplish this than the way I'm trying to go about it right now.  My data is similar to the table that I've pasted in below.  I'm trying to get a sum of the average time taken for each process.

I can get the average in total like this: Sum([Time Counted Seconds]) / Sum(Transactions)

But that's for all of the Processes.  What I really need is to do that for each process, and then add those together.  I started doing it with set analysis to isolate each process, like this:

sum({<Process={'Process 1'}>}[Time Counted Seconds]) / sum({<Process={'Process 1'}>}Transactions)

And I thought I may do that for each process and add them all together, but my real table has more like 20 different processes, and I also think I'm running into division by zero errors, because if only one of the expressions doesn't have a result, I'm getting a null in my table...it seems like there must be a better way to do this.

 

SystemProcessTime Counted SecondsTransactions
System AProcess 19050
System AProcess 16070
System AProcess 118080
System AProcess 22040
System AProcess 24035
System AProcess 310020
System AProcess 3250

10

System AProcess 37555

I'm grateful for any insights you may have.  Thanks!

2 Replies
YoussefBelloum
Champion
Champion

Hi,

you can try this:

=aggr(Sum([Time Counted Seconds]) / Sum(Transactions),Process)

Anonymous
Not applicable

if you want it summed, you would add sum to what youssef has

=sum(aggr(Sum([Time Counted Seconds]) / Sum(Transactions),Process))