Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
kasimyc
Contributor III
Contributor III

if avg aggr with average solutions time calculation

hi Qlikers,

i have a simple formul. calculate the average solution time. But i need to add one more criteria. I want to include the average of resolved records. I have specified the sample table and the current calculation below. If I want to calculate on HistoryStatu='Closed' here, how can I do it?

I would appreciate if you could guide me on how to solve this with set expression

Your help is appreciated

set exp: avg(aggr(max(HistoryTime)-min(HistoryTime),ProblemId)

calc.PNG

Labels (2)
1 Solution

Accepted Solutions
anthonyj
Creator III
Creator III

Hi @kasimyc ,

If you only want the min/max calculated on the ProblemId that have had a "Closed" status then you can use the possible ( P() ) function to return this list before calculating the min/max. This way in your example it should only return calculations for ProblemID = 2:

avg(aggr(max({$<ProblemId=p({1<HistoryStatu={Closed}>}ProblemId)>}HistoryTime)-min({$<ProblemId=p({1<HistoryStatu={Closed}>}ProblemId)>}HistoryTime),ProblemId)

Regards

Anthony

View solution in original post

2 Replies
anthonyj
Creator III
Creator III

Hi @kasimyc ,

If you only want the min/max calculated on the ProblemId that have had a "Closed" status then you can use the possible ( P() ) function to return this list before calculating the min/max. This way in your example it should only return calculations for ProblemID = 2:

avg(aggr(max({$<ProblemId=p({1<HistoryStatu={Closed}>}ProblemId)>}HistoryTime)-min({$<ProblemId=p({1<HistoryStatu={Closed}>}ProblemId)>}HistoryTime),ProblemId)

Regards

Anthony

kasimyc
Contributor III
Contributor III
Author

thanks Anthony, good trick