Microsoft Power BI DAX Formulas and Functions 2 — Questions and Answers
Question 1: What does the DAX time intelligence function TOTALYTD() calculate?
- The total for the last 12 months
- The cumulative total from the start of the year to the current date in context (Correct answer)
- The total for the current year only, ignoring slicers
- The year-over-year growth percentage
Correct answer: The cumulative total from the start of the year to the current date in context
TOTALYTD() calculates the cumulative total of an expression from the beginning of the current year through the last date in the current filter context.
Question 2: Which DAX function returns the same period from the previous year?
- PREVIOUSYEAR()
- PARALLELPERIOD()
- SAMEPERIODLASTYEAR() (Correct answer)
- DATEADD()
Correct answer: SAMEPERIODLASTYEAR()
SAMEPERIODLASTYEAR() returns a set of dates shifted one year back, allowing year-over-year comparisons.
Question 3: What does the DAX function RANKX() do?
- Assigns a sequential row number to a table
- Returns the ranking of a value within a specified table expression (Correct answer)
- Sorts a column in ascending order
- Counts the number of rows above a threshold
Correct answer: Returns the ranking of a value within a specified table expression
RANKX() returns the rank of an expression evaluated over a table, useful for ranking products, customers, or regions by a measure.
Question 4: What is 'filter context' in DAX?
- The color filter applied to a visual
- The set of active filters from slicers, rows, columns, and report filters that affect a DAX calculation (Correct answer)
- The WHERE clause written in Power Query
- The row limit applied to a table visual
Correct answer: The set of active filters from slicers, rows, columns, and report filters that affect a DAX calculation
Filter context in DAX is the combination of all active filters — from slicers, page filters, visual filters, and row/column headers — that constrain what data a measure evaluates.
Question 5: What is 'row context' in DAX and in which situations does it exist?
- The current row number in a visual table
- The current row being iterated in a calculated column or iterator function like SUMX (Correct answer)
- The filter applied by row-level security
- The row header in a matrix visual
Correct answer: The current row being iterated in a calculated column or iterator function like SUMX
Row context exists during calculated column evaluation and inside DAX iterator functions like SUMX, giving access to the current row's values.
Question 6: What does the DAX function HASONEVALUE() return?
- TRUE if the specified column has exactly one distinct value in the current filter context (Correct answer)
- TRUE if a column has no blank values
- The single value from a column when filtered
- TRUE if a measure returns a non-zero value
Correct answer: TRUE if the specified column has exactly one distinct value in the current filter context
HASONEVALUE() returns TRUE when exactly one distinct value is visible in a column under the current filter context, often used for conditional formatting or label display.
What does the DAX time intelligence function TOTALYTD() calculate?