0
0
Tableaubi_tool~10 mins

Date hierarchy (year, quarter, month, day) in Tableau - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a year level in the date hierarchy.

Tableau
DATETRUNC('[1]', [Order Date])
Drag options to blanks, or click blank then click option'
AYEAR
BMONTH
CDAY
DQUARTER
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'MONTH' instead of 'YEAR' truncates to month level, not year.
Using 'DAY' truncates to the smallest unit, not the top level.
2fill in blank
medium

Complete the code to extract the quarter from the date.

Tableau
DATEPART('[1]', [Order Date])
Drag options to blanks, or click blank then click option'
AQUARTER
BYEAR
CMONTH
DDAY
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'MONTH' returns the month number, not the quarter.
Using 'YEAR' returns the year, not the quarter.
3fill in blank
hard

Fix the error in the code to get the month name from the date.

Tableau
DATENAME('[1]', [Order Date])
Drag options to blanks, or click blank then click option'
AQUARTER
BYEAR
CMONTH
DDAY
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'DAY' returns the day name, not the month.
Using 'YEAR' returns the year as a number, not a name.
4fill in blank
hard

Fill both blanks to create a calculated field that checks if the day of the week is Monday.

Tableau
DATENAME('[1]', [Order Date]) = '[2]'
Drag options to blanks, or click blank then click option'
AWEEKDAY
BDAY
CMonday
DSunday
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'DAY' returns the day number, not the weekday name.
Using 'Sunday' instead of 'Monday' changes the condition.
5fill in blank
hard

Fill all three blanks to create a calculated field that checks if the date is in 2023 Q2.

Tableau
YEAR([Order Date]) = [1] AND DATEPART('[2]', [Order Date]) = [3]
Drag options to blanks, or click blank then click option'
A2023
BQUARTER
C2
DMONTH
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'MONTH' instead of 'QUARTER' changes the meaning.
Using a wrong year number causes the condition to fail.