DATEADD shifts a date by a specified number of intervals (days, months, quarters, years) to compare data across different time periods.
Click to reveal answer
beginner
Write the syntax of DATEADD in Power BI.
DATEADD(<dates>, <number_of_intervals>, <interval>) where <interval> can be DAY, MONTH, QUARTER, or YEAR.
Click to reveal answer
intermediate
How would you use DATEADD to get sales from the previous month?
Use DATEADD with -1 for the number_of_intervals and MONTH for the interval, like: DATEADD(Date[Date], -1, MONTH).
Click to reveal answer
intermediate
Why is DATEADD useful for creating time comparison measures?
It helps compare current data with past periods, like last month or last year, enabling trend analysis and performance tracking.
Click to reveal answer
beginner
What happens if you use DATEADD with a positive number_of_intervals?
It shifts the dates forward by that number of intervals, for example, moving one month ahead if interval is MONTH and number is 1.
Click to reveal answer
What interval options can you use with DATEADD in Power BI?
ADAY, MONTH, QUARTER, YEAR
BHOUR, MINUTE, SECOND
CWEEK, FORTNIGHT, MONTH
DDAY, WEEK, YEAR
✗ Incorrect
DATEADD supports DAY, MONTH, QUARTER, and YEAR intervals for shifting dates.
How do you shift dates one quarter back using DATEADD?
ADATEADD(Date[Date], -1, QUARTER)
BDATEADD(Date[Date], 1, QUARTER)
CDATEADD(Date[Date], -1, MONTH)
DDATEADD(Date[Date], 1, MONTH)
✗ Incorrect
Use -1 for number_of_intervals and QUARTER for interval to shift one quarter back.
What is the result of DATEADD(Date[Date], 0, MONTH)?
AShifts dates to the next month
BReturns the original dates without change
CShifts dates to the previous month
DReturns an error
✗ Incorrect
Using 0 as number_of_intervals returns the original dates unchanged.
Which scenario is best suited for using DATEADD?
ACalculating total sales for a single day
BSorting data alphabetically
CComparing sales this month to sales last month
DFiltering data by product category
✗ Incorrect
DATEADD is used to compare data across different time periods, like this month vs last month.
If you want to compare this year's sales to last year's, which DATEADD call is correct?
ADATEADD(Date[Date], 1, YEAR)
BDATEADD(Date[Date], 12, MONTH)
CDATEADD(Date[Date], -12, MONTH)
DDATEADD(Date[Date], -1, YEAR)
✗ Incorrect
Use -1 for number_of_intervals and YEAR for interval to shift dates one year back.
Explain how DATEADD helps in creating time comparison reports in Power BI.
Think about comparing sales this month to last month.
You got /4 concepts.
Describe the syntax and parameters of the DATEADD function and what each part means.
Break down the function into its three parts.
You got /4 concepts.
Practice
(1/5)
1. What does the DATEADD function do in Power BI?
easy
A. It shifts dates by a specified number of days, months, quarters, or years.
B. It adds two date columns together.
C. It formats dates into text strings.
D. It calculates the difference between two dates.
Solution
Step 1: Understand the purpose of DATEADD
DATEADD is used to move dates forward or backward by a set period like days or months.
Step 2: Compare with other date functions
Unlike difference or formatting functions, DATEADD shifts dates by a period.
Final Answer:
It shifts dates by a specified number of days, months, quarters, or years. -> Option A
Quick Check:
DATEADD shifts dates = D [OK]
Hint: Remember: DATEADD moves dates by periods, not calculates differences [OK]
Common Mistakes:
Confusing DATEADD with DATEDIFF
Thinking DATEADD formats dates
Assuming DATEADD adds two dates
2. Which of the following is the correct syntax to shift dates by 1 month using DATEADD in DAX?
easy
A. DATEADD(DateColumn, '1 month')
B. DATEADD(DateColumn, 1, MONTH)
C. DATEADD(DateColumn, MONTH, 1)
D. DATEADD(1, DateColumn, MONTH)
Solution
Step 1: Recall DATEADD syntax
DATEADD requires three arguments: a date column, number of intervals, and interval type.
Step 2: Match correct argument order
The correct order is DATEADD(DateColumn, number, interval), so DATEADD(DateColumn, 1, MONTH) matches.
Final Answer:
DATEADD(DateColumn, 1, MONTH) -> Option B
Quick Check:
Correct syntax = A [OK]
Hint: Syntax order: DateColumn, number, then interval [OK]
Common Mistakes:
Swapping interval and number arguments
Using quotes around interval
Passing number before date column
3. Given the measure:
Sales Last Month = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -1, MONTH))
What does this measure calculate?
medium
A. Total sales for all months except the current one.
B. Total sales for the next month relative to the current filter context.
C. Total sales for the current month only.
D. Total sales for the previous month relative to the current filter context.
Solution
Step 1: Analyze DATEADD usage
DATEADD shifts the date filter by -1 month, meaning one month back.
Step 2: Understand CALCULATE with shifted filter
CALCULATE applies the shifted date filter to sum sales for that previous month.
Final Answer:
Total sales for the previous month relative to the current filter context. -> Option D
Quick Check:
DATEADD with -1 month = previous month sales [OK]
Hint: Negative number in DATEADD means past period [OK]
Common Mistakes:
Thinking negative shifts future dates
Assuming it sums current month sales
Confusing previous and next month
4. You wrote this measure:
Sales Next Quarter = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], 1, QUARTER))
But it returns an error. What is the likely cause?
medium
A. The interval 'QUARTER' is not a valid argument for DATEADD.
B. The number argument must be negative to shift forward.
C. The date column is not continuous or missing dates.
D. CALCULATE cannot be used with DATEADD.
Solution
Step 1: Check validity of interval argument
QUARTER is a valid interval for DATEADD, so The interval 'QUARTER' is not a valid argument for DATEADD. is incorrect.
Step 2: Understand DATEADD requirements
DATEADD requires a continuous date column without gaps; missing dates cause errors.
Step 3: Verify number argument
Positive number shifts forward, so The number argument must be negative to shift forward. is wrong.
Step 4: Confirm CALCULATE usage
CALCULATE works with DATEADD filters, so CALCULATE cannot be used with DATEADD. is wrong.
Final Answer:
The date column is not continuous or missing dates. -> Option C
Quick Check:
Continuous date column needed = B [OK]
Hint: Ensure date column is continuous for DATEADD [OK]
Common Mistakes:
Using non-continuous date columns
Misunderstanding interval validity
Thinking negative number shifts forward
5. You want to create a measure that compares sales of the current month to the same month last year using DATEADD. Which DAX formula correctly achieves this?
hard
A. Sales Same Month Last Year = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -1, YEAR))
B. Sales Same Month Last Year = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -12, QUARTER))
C. Sales Same Month Last Year = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -1, MONTH))
D. Sales Same Month Last Year = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -1, QUARTER))
Solution
Step 1: Understand the goal
We want to compare sales for the same month but one year earlier.
Step 2: Analyze each option's date shift
Sales Same Month Last Year = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -1, MONTH)) shifts by 1 month back, not a year. Sales Same Month Last Year = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -12, QUARTER)) shifts by 12 quarters back, which is 3 years, not one year. Sales Same Month Last Year = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -1, YEAR)) shifts by 1 year back, directly matching the goal. Sales Same Month Last Year = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -1, QUARTER)) shifts by 1 quarter back, which is 3 months.
Step 3: Choose the clearest and correct interval
Using YEAR interval with -1 is the best practice for same month last year comparison.
Final Answer:
Sales Same Month Last Year = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -1, YEAR)) -> Option A
Quick Check:
Shift by -1 YEAR for same month last year = C [OK]
Hint: Use YEAR interval with -1 to shift one year back [OK]
Common Mistakes:
Using -12 QUARTER instead of -1 YEAR
Shifting by -1 MONTH or -1 QUARTER incorrectly
Confusing months and years intervals
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.