Challenge your understanding of advanced DAX calculations, focusing on context transition and iterators. This quiz helps solidify how DAX handles row and filter context, practical use of iterators, and how different functions affect context in data analysis expressions.
When using CALCULATE inside a row context, what does context transition do in DAX?
Explanation: CALCULATE applies context transition by converting the current row context into an equivalent filter context, allowing filter-based evaluation. Removing filters entirely is done with ALL, not via context transition. Storing results in a temporary table is unrelated to context transition. Disabling evaluation context is not what context transition does; it actually creates a filter context.
Which DAX function acts as an iterator by evaluating an expression for each row in a table?
Explanation: SUMX is an iterator; it processes each row in the table and sums the results of the evaluated expression. SUM simply totals values in a column and does not iterate over expressions. COUNTROWS counts the number of rows but does not evaluate an expression row-wise. VALUES returns distinct values, not for iteration.
Which of the following best describes how context transition behaves in a calculated column?
Explanation: In calculated columns, DAX does not automatically perform context transition; it stays within the row context unless explicitly invoked. Context transition 'always applying' is incorrect as it must be triggered, typically by CALCULATE. The order of columns is unrelated to context transition. Duplicate rows are not a direct result of context transition.
Given the functions AVERAGEX, SUM, COUNTX, and MAX, which are DAX iterators?
Explanation: Both AVERAGEX and COUNTX are iterator functions as they evaluate expressions for each row in a table. SUM and MAX are simple aggregators, not iterators. The pairings with SUM or MAX are incorrect because these functions do not iterate over expressions.
Which function automatically creates a row context when used in DAX?
Explanation: SUMX is an iterator and thus automatically creates a row context as it evaluates the expression for each row. SUM only performs a simple sum without creating row context. ALL removes filters but does not establish row context. DISTINCT returns unique values and does not involve row context.
In calculated columns, for what purpose is the EARLIER function typically used in DAX?
Explanation: EARLIER allows access to an outer row context when there are nested row contexts, which is common in calculated columns. Retrieving previous tables or resetting row context is not its function. Filtering out duplicate rows is accomplished with DISTINCT or REMOVEFILTERS, not EARLIER.
If CALCULATE wraps a measure within a calculated column, what happens regarding row and filter context?
Explanation: When CALCULATE is used, it transforms the existing row context into a filter context, which makes context transition possible. Row context is not discarded, but rather converted. CALCULATE does not remove filter context entirely. The statement about merging and ignoring both contexts is incorrect.
What does the VALUES function do when used inside a CALCULATE statement?
Explanation: Inside CALCULATE, VALUES returns a table of unique values, which then becomes a filter. Sorting is not done by VALUES but may be performed by other means. Removing all filters is the job of ALL, not VALUES. Returning only the first value would be done by FIRSTNONBLANK or similar.
How do DAX iterator functions like SUMX handle blank rows in a table?
Explanation: SUMX and similar iterators will skip blank rows unless the expression evaluates to a number or value for that row. Summing blanks as zero is not correct because they are often skipped, not treated as zero. They do not remove blank rows preemptively, nor do they generate errors for blanks unless an invalid operation occurs.
If two tables are connected by a bidirectional relationship, how does context transition affect calculations involving those tables?
Explanation: With bidirectional relationships, filters can propagate from one table to another, and context transition ensures this effect is respected in calculations. Context transition does not disable filtering; it enhances the propagation. Only the target table being filtered is inaccurate in a bidirectional context. Duplicate rows are unrelated to context transition or filter direction.