Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cbaqir
Specialist
Specialist

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)

Labels (4)
1 Solution

Accepted Solutions
marcus_sommer
MVP & Luminary
MVP & Luminary

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

View solution in original post

4 Replies
marcus_sommer
MVP & Luminary
MVP & Luminary

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

cbaqir
Specialist
Specialist
Author

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?

Brett_Bleess
Support (Former)
Support (Former)

@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

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
marcus_sommer
MVP & Luminary
MVP & Luminary

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

View solution in original post