Forum Discussion

chahineatallah's avatar
chahineatallah
Icon for Helper III rankHelper III
4 years ago
Solved

Nested Iterators

hello, am having hard time understanding nested iterators   I created one small table with quantities but still am not understanding why am having different results 1. I created regular quantity c...
  • tamerj1's avatar
    4 years ago

    Hi chahineatallah 
    The reason is context transition. By default all measures are wrapped with CALCULATE forcing context transition. In your case I can tell that products A and B each has two rows while product C has only one row. In the case on nested SUMX and two rows per product the result will be doubled as for each row the inner SUMX will produce the sum of the two rows visible in the current filter context. While when referring to a measure or when wrapping the inner SUMX with CALCULATE then each row or the outer SUMX will be transformed into a filter context that will bring the rows of iteration of the inner SUMX down to only one row. 
    This is why when there is only one row per product the result of the two measures is the same.