
Re: Complex expression doesn't allow to open qvw with many data
Marcus Sommer Nov 15, 2017 8:03 AM (in response to ADRIANO STEANELLI )I'm not surprised that this is quite slow to uncalculable by so many aggr and TOTAL within the interrecordfunction below. I have the feeling that not all of the aggr, below and TOTAL are necessary and it could be simplified in some way.
I suggest that you make a restart with this task beginning with rather simple sum/count expressions and if they return the expected results and needs to consolidated on step more if there are simpler solutions as just using aggr  especially by including some script precalculations.
 Marcus

Re: Complex expression doesn't allow to open qvw with many data
ADRIANO STEANELLI Nov 15, 2017 9:08 AM (in response to Marcus Sommer )Hi Marcus,
thanks for your feedback, I've done as you said and below the best way of my review:
=2*((Rangesum(below((Aggr(num(Rank(Sum(consumption),4)),contentid)*(sum(consumption)/sum(TOTAL consumption))),0,max(TOTAL(Aggr(num(Rank(Sum(consumption),4)),contentid))))))*(Rangesum(below((1/(Rangesum(below(TOTAL sum(consumption/sum(TOTAL consumption)),0,max(TOTAL (Aggr(num(Rank(Sum(consumption),4)),contentid))))))),0,max(TOTAL(Aggr(num(Rank(Sum(consumption),4)),contentid)))))))1
but nothing is changed. I've also splitted the entire expression into some variables declared on Variables Overview like this:
MaxRank =max(TOTAL(aggr(num(rank(sum(consumption),4)),contentid)))
k1 =aggr(num(rank(sum(consumption),4)),contentid)*(sum(consumption)/sum(TOTAL consumption))
k2 =1/(rangesum(below(TOTAL sum(consumption/sum(TOTAL consumption)),0,max(TOTAL (aggr(num(rank(sum(consumption),4)),contentid))))))
ECS =2*((rangesum(below($(k1),0,$(MaxRank))))*(rangesum(below($(k2),0,$(MaxRank)))))1
but nothing is changed.
If you are interested, I've attached an excel file with calculation and for your reference you can find formula at the following link Appendix section..
Many thanks

Re: Complex expression doesn't allow to open qvw with many data
Marcus Sommer Nov 15, 2017 11:36 AM (in response to ADRIANO STEANELLI )To separate expressions or parts of it in variables is definitely useful to improve the readability and maintainability but it won't increase the performance (unless it leads to some precalculation and not an expression is returned else a value) because the executed expression itself didn't change.
I meant to check if you really need all the aggrfunctions, see:
When should the Aggr() function NOT be used?
 Marcus

