Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Context in Iterator functions: dummy example

Hello Community,   I am afraid I do not understand how context is computed in Iterator Functions. I have been doing some tests and I really do not understand the results. Can somebody give some lig...
  • v-kkf-msft's avatar
    5 years ago

    Hi Anonymous ,

     

    Please read this article to understand the context of the iterator function.

     

    The following takes the measure "test4" as an example to explain its context.

    The MINX function returns the smallest value that results from evaluating an expression for each row of a table. So we can concatenate the result of an expression evaluated for each row in a table, using the following measure.

     

    ConcatenateX = 
    	CONCATENATEX( 
    		ALL('Table'[Country]), 
    		[measureA], 
    		"," 
    	)

     

    ALL('Table'[Country]) returns 3 values. According to the documentation, we know that it will perform 3 iterations.

    • For the first table in the figure, measureA needs to be calculated iteratively for three countries based on the filter Year and the Store. The result of the iteration is the combination of the three columns of the matrix.

     

    • For the second table in the figure, measureA needs to be calculated iteratively for three countries based on the filter Year. The result of the iteration is the combination of the three columns of the matrix.

     

    Figure:

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.