Microsoft Power BI DAX Formulas and Functions 1 — Questions and Answers
Question 1: What does the DAX function CALCULATE() do?
- Performs mathematical calculations on columns
- Evaluates an expression in a modified filter context (Correct answer)
- Counts rows in a table
- Returns a value from a related table
Correct answer: Evaluates an expression in a modified filter context
CALCULATE() evaluates a DAX expression after applying the specified filter modifications to the filter context.
Question 2: What is the result of the DAX expression SUMX(Sales, Sales[Quantity] * Sales[Price])?
- The sum of the Quantity column
- The row-by-row product of Quantity and Price, summed across all rows (Correct answer)
- The average of Quantity times Price
- A count of rows where Quantity times Price is not blank
Correct answer: The row-by-row product of Quantity and Price, summed across all rows
SUMX iterates over each row in the Sales table, multiplies Quantity by Price, and then sums all the resulting values.
Question 3: What does ALL() do when used inside CALCULATE()?
- Applies all slicers to the calculation
- Removes filters from the specified table or columns (Correct answer)
- Adds all rows to the calculation
- Returns all unique values in a column
Correct answer: Removes filters from the specified table or columns
ALL() removes any existing filters on the specified table or columns, allowing the measure to calculate across all data regardless of slicers.
Question 4: What is the difference between DISTINCTCOUNT() and COUNT() in DAX?
- COUNT counts blanks; DISTINCTCOUNT does not
- DISTINCTCOUNT counts unique non-blank values; COUNT counts all non-blank values including duplicates (Correct answer)
- They are identical in behavior
- COUNT only works on numeric columns; DISTINCTCOUNT works on text
Correct answer: DISTINCTCOUNT counts unique non-blank values; COUNT counts all non-blank values including duplicates
DISTINCTCOUNT counts the number of unique, non-blank values in a column, while COUNT counts all non-blank values including duplicates.
Question 5: In DAX, what does the RELATED() function do?
- Creates a new relationship between tables
- Returns a value from a related table by following an existing relationship (Correct answer)
- Lists all related tables in the model
- Filters a related table
Correct answer: Returns a value from a related table by following an existing relationship
RELATED() follows an existing many-to-one relationship from the current row context to retrieve a value from a related table.
Question 6: What does the DAX function DIVIDE(numerator, denominator, alternateResult) do differently than simply using the / operator?
- It rounds the result to two decimal places
- It returns the alternateResult (default 0) instead of an error when dividing by zero (Correct answer)
- It only works with integer values
- It performs integer division
Correct answer: It returns the alternateResult (default 0) instead of an error when dividing by zero
DIVIDE() safely handles division by zero by returning an alternate result (default BLANK or a specified value) instead of throwing an error.
What does the DAX function CALCULATE() do?