But sometimes it returns an error. What is the likely cause and how to fix it?
medium
A. SUM(Sales[Quantity]) is zero; fix by adding alternateResult like 0 in DIVIDE
B. SUM(Sales[Amount]) is zero; fix by changing numerator to 1
C. Syntax error; fix by adding commas between arguments
D. DIVIDE cannot handle sums; use simple division instead
Solution
Step 1: Identify cause of error
Division by zero error happens if denominator SUM(Sales[Quantity]) is zero.
Step 2: Fix by adding alternateResult
Adding a third parameter like 0 to DIVIDE returns fallback instead of error.
Final Answer:
SUM(Sales[Quantity]) is zero; fix by adding alternateResult like 0 in DIVIDE -> Option A
Quick Check:
Add fallback to avoid zero division error [OK]
Hint: Add fallback value in DIVIDE to avoid zero errors [OK]
Common Mistakes:
Changing numerator instead of denominator
Ignoring zero divisor issue
Assuming syntax error without checking logic
5. You want to create a measure that calculates the average price per unit sold but returns "N/A" if quantity sold is zero or missing. Which DAX formula correctly uses DIVIDE to achieve this?
hard
A. AveragePrice = SUM(Sales[TotalPrice]) / SUM(Sales[Quantity])
B. AveragePrice = DIVIDE(SUM(Sales[TotalPrice]), SUM(Sales[Quantity]), "N/A")
C. AveragePrice = DIVIDE(SUM(Sales[Quantity]), SUM(Sales[TotalPrice]), 0)
D. AveragePrice = DIVIDE(SUM(Sales[TotalPrice]), SUM(Sales[Quantity]))
Solution
Step 1: Identify numerator and denominator
Average price = total price divided by quantity sold.
Step 2: Use DIVIDE with fallback
Use DIVIDE with "N/A" as alternateResult to handle zero or missing quantity.
Final Answer:
AveragePrice = DIVIDE(SUM(Sales[TotalPrice]), SUM(Sales[Quantity]), "N/A") -> Option B
Quick Check:
DIVIDE with fallback string for zero divisor [OK]
Hint: Use DIVIDE with fallback string for safe average [OK]
Common Mistakes:
Swapping numerator and denominator
Not providing fallback value
Using simple division without error handling
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.