Forum Discussion
Multiple row Context within Iterators
Thanks tamerj1 for your prompt response.
Sorry, i am still confused about it. Even if table variable is evaluated once, how will it change the working of 'Addcolumns' function. Suppose, the variable 'date_sale_table' generates a table in-memory.
Now, in 'Addcolumns' function, we are just iterating over 'date_sale_table' variable. We are nowhere evaluating it again.. Will iterating through it also amount to evaluation?
I hope, i am able to articulate my question.
To explain further
the inner AVERAGEX evalutes the average sales for each row of the table variable which is fine. Howeverfor each single iteration of ADDCOLUMNS, the outer SUMX sums the averages of all the dates in the table variable which produces the total sales over ech single row of the created table.
- ARU_3 years agoAdvocate I
ok tamerj1 . Many thanks. appreciate your patience.
I get your point. Everything you have said makes sense to me now. However, i am still not able to accept the fact that the Calculate function doesnt invoke context transition.
I know you have said that table variable is evaluated once and hence context transition cannot be invoked. But still i don't understand why? Why a table variable which is already evaluated treated differently from other table objects.
I tried learning more about table variables, but unable to find any suitable explanation of its relationship with Calculate in the context of transition.
- ARU_3 years agoAdvocate I
Thanks tamerj1 -
You are a Star 🙂 Your approach of explanation is just awesome. I thank you for that.After carefully study of your comments and computations, I think it is safe to say that Calculate context transition is ineffective on variable tables.
As an extension of the above point, i want to ask when you say that newly created filter context cannot recalculate variable table during Sumx iteration, doesn't the same logic apply to AverageX iteration?
See, my understanding of context transition is application of filters from the row being iterated to the calculate expression.
As during AverageX iteration too, you are filtering the variable table and computing Average. Doesn't this amount to recalculation of variable tables?