Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What does the DATEDIFF function do in Tableau?
DATEDIFF calculates the difference between two dates in a specified unit like days, months, or years.
Click to reveal answer
beginner
How do you use DATEADD in Tableau?
DATEADD adds a specified number of units (days, months, years) to a date and returns the new date.
Click to reveal answer
beginner
Example: What is the result of DATEDIFF('month', #2023-01-01#, #2023-04-01#)?
The result is 3 because there are 3 full months between January 1, 2023, and April 1, 2023.
Click to reveal answer
beginner
If you want to find the date 10 days after March 5, 2024, which function and parameters do you use?
Use DATEADD('day', 10, #2024-03-05#) to get March 15, 2024.
Click to reveal answer
intermediate
Why is it useful to use DATEDIFF and DATEADD in business reports?
They help compare dates, calculate durations, and create dynamic date ranges for better insights.
Click to reveal answer
What does DATEDIFF('day', #2024-01-01#, #2024-01-10#) return?
A9
B10
C11
D1
✗ Incorrect
DATEDIFF counts the number of day boundaries crossed, so from Jan 1 to Jan 10 is 9 days difference.
Which function adds months to a date in Tableau?
ADATEDIFF
BNOW
CDATENAME
DDATEADD
✗ Incorrect
DATEADD adds a specified number of units like months to a date.
What will DATEADD('year', -1, #2023-06-15#) return?
A#2024-06-15#
B#2022-06-15#
C#2023-05-15#
D#2023-07-15#
✗ Incorrect
It subtracts 1 year from June 15, 2023, resulting in June 15, 2022.
If you want to find how many months between two dates, which function do you use?
ADATEDIFF
BNOW
CDATEADD
DMAKEDATE
✗ Incorrect
DATEDIFF calculates the difference between two dates in the specified unit, such as months.
What is the result of DATEDIFF('week', #2024-01-01#, #2024-01-15#)?
A1
B0
C2
D3
✗ Incorrect
There are 2 full week boundaries between Jan 1 and Jan 15.
Explain how you would calculate the number of days between two dates using Tableau functions.
Think about which function measures difference and what unit to use.
You got /3 concepts.
Describe how to add 3 months to a given date in Tableau and why this might be useful in reports.
Focus on the function that changes dates by adding time.
You got /4 concepts.
Practice
(1/5)
1. What does the Tableau function DATEDIFF('day', #2024-01-01#, #2024-01-10#) return?
easy
A. 10
B. 11
C. 9
D. Error
Solution
Step 1: Understand DATEDIFF parameters
DATEDIFF counts the number of boundaries crossed between two dates in the specified unit, here 'day'.
Step 2: Calculate days between 2024-01-01 and 2024-01-10
From Jan 1 to Jan 10, there are 9 full days difference, but DATEDIFF counts the number of day boundaries crossed, which is 10 (Jan 1 to Jan 2 is 1, ... Jan 9 to Jan 10 is 9, plus the starting boundary counts as well).
Final Answer:
10 -> Option A
Quick Check:
DATEDIFF('day', start, end) counts days crossed = 10 [OK]
Hint: DATEDIFF counts boundaries crossed, not total days [OK]
Common Mistakes:
Counting both start and end dates as full days
Confusing DATEDIFF with DATEADD
Using wrong unit like 'month' instead of 'day'
2. Which of the following is the correct syntax to add 3 months to a date field [Order Date] in Tableau?
easy
A. DATEADD([Order Date], 3, 'month')
B. DATEADD('3 months', [Order Date])
C. DATEDIFF('month', [Order Date], 3)
D. DATEADD('month', 3, [Order Date])
Solution
Step 1: Recall DATEADD syntax
DATEADD takes three arguments: date part as string, number to add, and the date field.
Step 2: Match correct argument order
DATEADD('month', 3, [Order Date]) matches syntax: DATEADD('month', 3, [Order Date]). Others have wrong order or wrong function.
Adding 15 days to Jan 1, 2024 results in Jan 16, 2024.
Step 2: Calculate DATEDIFF in weeks between Jan 1 and Jan 16
Weeks crossed: Jan 1 to Jan 8 (1 week), Jan 8 to Jan 15 (2 weeks), Jan 15 to Jan 16 does not complete another week. So total 2 weeks difference.
Final Answer:
2 -> Option A
Quick Check:
DATEDIFF('week', start, end) counts full weeks crossed = 2 [OK]
Hint: Add days first, then count weeks crossed [OK]
Common Mistakes:
Counting partial weeks as full weeks
Mixing up order of DATEADD and DATEDIFF
Using wrong date formats
4. You wrote this Tableau formula but it gives an error: DATEADD('day', '5', [Ship Date]) What is the problem?
medium
A. The date field [Ship Date] must be a string
B. The date part 'day' should be in uppercase
C. The number of days should not be in quotes
D. DATEADD cannot add days, only months
Solution
Step 1: Check argument types in DATEADD
DATEADD expects the second argument as a number, not a string.
Step 2: Identify error cause
Using '5' (string) instead of 5 (number) causes a type error.
Final Answer:
The number of days should not be in quotes -> Option C
Quick Check:
Number argument must be numeric, not string [OK]
Hint: Numbers in DATEADD must be numeric, no quotes [OK]
Common Mistakes:
Putting numbers in quotes
Assuming case sensitivity for 'day'
Thinking DATEADD only works with months
5. You want to find how many full quarters have passed between #2023-02-15# and a date 200 days later. Which Tableau formula correctly calculates this?
hard
A. DATEDIFF('month', #2023-02-15#, DATEADD('day', 200, #2023-02-15#)) / 3
B. DATEDIFF('quarter', #2023-02-15#, DATEADD('day', 200, #2023-02-15#))
C. DATEDIFF('quarter', DATEADD('day', 200, #2023-02-15#), #2023-02-15#)
D. DATEADD('quarter', 200, #2023-02-15#)
Solution
Step 1: Calculate the date 200 days after Feb 15, 2023
Using DATEADD('day', 200, #2023-02-15#) gives the target date.
Step 2: Use DATEDIFF with 'quarter' to count full quarters passed
DATEDIFF('quarter', start_date, end_date) counts how many quarter boundaries are crossed.
Step 3: Evaluate options
DATEDIFF('quarter', #2023-02-15#, DATEADD('day', 200, #2023-02-15#)) correctly uses DATEDIFF with 'quarter' and correct date order. DATEDIFF('month', #2023-02-15#, DATEADD('day', 200, #2023-02-15#)) / 3 divides months by 3 but may give decimals, not full quarters. DATEDIFF('quarter', DATEADD('day', 200, #2023-02-15#), #2023-02-15#) reverses dates causing negative result. DATEADD('quarter', 200, #2023-02-15#) misuses DATEADD.
Final Answer:
DATEDIFF('quarter', #2023-02-15#, DATEADD('day', 200, #2023-02-15#)) -> Option B
Quick Check:
Use DATEDIFF('quarter', start, end) for full quarters [OK]
Hint: Use DATEDIFF with 'quarter' and correct date order [OK]