0
0
Tableaubi_tool~10 mins

Date hierarchy (year, quarter, month, day) in Tableau - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

Sample dates with their breakdown into year, quarter, month, and day components.

CellValue
A1Date
A22023-01-15
A32023-04-10
A42023-07-05
A52023-10-20
B1Year
B22023
B32023
B42023
B52023
C1Quarter
C2Q1
C3Q2
C4Q3
C5Q4
D1Month
D2January
D3April
D4July
D5October
E1Day
E215
E310
E45
E520
Formula Trace
YEAR([Date]), "Q" + STR(QUARTER([Date])), DATENAME('month', [Date]), DAY([Date])
Step 1: YEAR('2023-01-15')
Step 2: "Q" + STR(QUARTER('2023-01-15'))
Step 3: DATENAME('month', '2023-01-15')
Step 4: DAY('2023-01-15')
Step 5: YEAR('2023-04-10')
Step 6: "Q" + STR(QUARTER('2023-04-10'))
Step 7: DATENAME('month', '2023-04-10')
Step 8: DAY('2023-04-10')
Step 9: YEAR('2023-07-05')
Step 10: "Q" + STR(QUARTER('2023-07-05'))
Step 11: DATENAME('month', '2023-07-05')
Step 12: DAY('2023-07-05')
Step 13: YEAR('2023-10-20')
Step 14: "Q" + STR(QUARTER('2023-10-20'))
Step 15: DATENAME('month', '2023-10-20')
Step 16: DAY('2023-10-20')
Cell Reference Map
    A          B       C         D         E
1 | Date     | Year  | Quarter | Month   | Day  |
2 |2023-01-15| 2023  | Q1      | January | 15   |
3 |2023-04-10| 2023  | Q2      | April   | 10   |
4 |2023-07-05| 2023  | Q3      | July    | 5    |
5 |2023-10-20| 2023  | Q4      | October | 20   |
The Date column (A) is the source. Columns B, C, D, and E show the year, quarter, month name, and day extracted from each date.
Result
    A          B       C         D         E
1 | Date     | Year  | Quarter | Month   | Day  |
2 |2023-01-15| 2023  | Q1      | January | 15   |
3 |2023-04-10| 2023  | Q2      | April   | 10   |
4 |2023-07-05| 2023  | Q3      | July    | 5    |
5 |2023-10-20| 2023  | Q4      | October | 20   |
The final output shows each date broken down into year, quarter, month name, and day, forming a date hierarchy useful for analysis.
Sheet Trace Quiz - 3 Questions
Test your understanding
What quarter does the date 2023-04-10 belong to?
AQ3
BQ2
CQ1
DQ4
Key Result
Extract year, quarter (formatted as Q1-Q4), month name, and day from a date to build a date hierarchy.