

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aggr Avg of Variables
I have several variables that I need to aggr an average over DEFECT_ID. The individual variables work but the Aggr Avg does not and I am not sure why.
vAvgClnSponTime: alt(num(avg(aggr(sum( {$<ADJ_GOVERNANCE_PHASE={'2.2*'} >} ADJ_GOVERNANCE_PHASE_TAT),DEFECT_ID)),'##0'),0)
vAvgWaitingDAG: alt(num(avg(aggr(max( {$<ADJ_GOVERNANCE_PHASE={'4.1*'}>} STATUS_END_DATE),DEFECT_ID)
-aggr(min( {$<ADJ_GOVERNANCE_PHASE={'3.2*'},TICKET_STATUS={'Complete'}>} STATUS_START_DATE),DEFECT_ID)),'##0'),0)
vAvgWaitingRelease: num(avg(aggr(sum( {$<TICKET_STATUS={'Ready for Release'}>} STATUS_TAT_DATE),DEFECT_ID)),'##0')
vAvgTotalDays: num(sum(ADJ_GOVERNANCE_PHASE_TAT)/count(DISTINCT DEFECT_ID),'##0')
AGGR AVG Variables:
vAvgInformaticsTime: num($(vAvgTotalDays)- $(vAvgWaitingTime),'##0')
vAvgWaitingTime: aggr(avg($(vAvgWaitingRelease) + $(vAvgClnSponTime) + $(vAvgWaitingDAG)),DEFECT_ID)
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nearly always there are ways to make already complex things much more complicated ... but IMO it's the wrong direction. In your case it would be probably very hard to make them work and much more likely would be that it would lead to another disadvantages - therefore I recommend you relinquish the approach of nesting the variables and used just:
num($(vAvgTotalDays)- $(vAvgWaitingTime),'##0')
aggr(avg($(vAvgWaitingRelease) + $(vAvgClnSponTime) + $(vAvgWaitingDAG)),DEFECT_ID)
as expressions.
Beside the technically limitation for the comma-handling on the Qlik side in missing appropriate masking-logics respectively in regard to the order of parsing/evaluation of the variables - the use of variables should be only done if they have a real benefit in avoiding redundancy or simplifying things. To apply them to nearly every calculation - which seems to be quite common - is the complete opposite and could need more efforts as developing an entire environment.
- Marcus


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nesting of variables is highly problematic especially if they contain commas which are always treated as parameter-delimiter. My suggestion to relinquish on this because even if you find technically ways for it the increase of complexity and the efforts to develop it are usually much too high. Just keep it as simple as possible.
- Marcus


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is the suggestion then just to use one variable and use the full expression in the 2 bold fields above? Is there no other option?
.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@marcus_sommer I am guessing the notifications are still not working correctly, just wanted to let you know poster returned with a couple more questions, if you have some time to circle back, much appreciated, thanks in advance!
Regards,
Brett
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nearly always there are ways to make already complex things much more complicated ... but IMO it's the wrong direction. In your case it would be probably very hard to make them work and much more likely would be that it would lead to another disadvantages - therefore I recommend you relinquish the approach of nesting the variables and used just:
num($(vAvgTotalDays)- $(vAvgWaitingTime),'##0')
aggr(avg($(vAvgWaitingRelease) + $(vAvgClnSponTime) + $(vAvgWaitingDAG)),DEFECT_ID)
as expressions.
Beside the technically limitation for the comma-handling on the Qlik side in missing appropriate masking-logics respectively in regard to the order of parsing/evaluation of the variables - the use of variables should be only done if they have a real benefit in avoiding redundancy or simplifying things. To apply them to nearly every calculation - which seems to be quite common - is the complete opposite and could need more efforts as developing an entire environment.
- Marcus
