Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a continuous date axis in Tableau.
Tableau
DATEPART("[1]", [Order Date])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing MONTH or DAY creates discrete segments, not continuous.
✗ Incorrect
Using YEAR in DATEPART creates a continuous date axis by year.
2fill in blank
mediumComplete the code to create a discrete date field in Tableau.
Tableau
DATETRUNC("[1]", [Order Date])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using YEAR creates yearly grouping, which can be continuous or discrete depending on context.
✗ Incorrect
Using MONTH with DATETRUNC creates a discrete date field by month.
3fill in blank
hardFix the error in the year comparison calculation.
Tableau
IF DATEPART("year", [Order Date]) = [1] THEN [Sales] END
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numbers causes type mismatch errors.
✗ Incorrect
The year value should be a number without quotes: 2023.
4fill in blank
hardFill both blanks to sum sales for January 2023.
Tableau
SUM(IF DATETRUNC("[1]", [Order Date]) = [2] THEN [Sales] ELSE 0 END)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using YEAR truncation or wrong date values causes incorrect grouping.
✗ Incorrect
DATETRUNC with MONTH truncates dates to month start, and comparing to DATE('2023-01-01') filters January 2023.
5fill in blank
hardFill all three blanks to create a discrete date filter for sales in January and February.
Tableau
IF DATENAME("[1]", [Order Date]) IN ([2], [3]) THEN [Sales] ELSE 0 END
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using YEAR or QUARTER instead of MONTH causes wrong filtering.
✗ Incorrect
DATENAME with MONTH returns month names; filtering for January and February selects those months.