Dashboard Mode - Date calculations (DATEDIFF, DATEADD)
Dashboard Goal
Understand how sales change over time by calculating the difference in days between order and ship dates, and analyze sales trends by shifting dates forward or backward.
Jump into concepts and practice - no test required
Understand how sales change over time by calculating the difference in days between order and ship dates, and analyze sales trends by shifting dates forward or backward.
| Order ID | Order Date | Ship Date | Sales |
|---|---|---|---|
| 1001 | 2024-01-01 | 2024-01-05 | 250 |
| 1002 | 2024-01-03 | 2024-01-06 | 450 |
| 1003 | 2024-01-07 | 2024-01-10 | 300 |
| 1004 | 2024-01-10 | 2024-01-15 | 500 |
| 1005 | 2024-01-12 | 2024-01-14 | 150 |
DATEDIFF('day', [Order Date], [Ship Date])DATEADD('day', 7, [Order Date]) shifts order dates 7 days forward.DATEDIFF('day', [Order Date], [Ship Date])+-----------------------------+-----------------------------+ | Average Shipping Time (KPI) | Sales by Order Date (Bar) | | | | +-----------------------------+-----------------------------+ | Sales Trend Shifted by 7 Days (Line Chart) | | | +---------------------------------------------------------+ | Orders with Shipping Delay (Table) | +---------------------------------------------------------+
A date filter allows selecting a range of order dates. When the user changes the date range:
If you add a filter to show only orders with Order Date after 2024-01-05, which components update and what changes occur?
DATEDIFF('day', #2024-01-01#, #2024-01-10#) return?[Order Date] in Tableau?DATEDIFF('week', #2024-01-01#, DATEADD('day', 15, #2024-01-01#))DATEADD('day', '5', [Ship Date])#2023-02-15# and a date 200 days later. Which Tableau formula correctly calculates this?