An online sales company has a table data source that contains Order Date. Products ship on the first day of each month for all orders from the previous month.
The consultant needs to know the average number of days that a customer must wait before a product is shipped.
Which calculation should the consultant use?
The correct calculation to determine the average number of days a customer must wait before a product is shipped is to first find the shipping date, which is the first day of the following month after the order date. This is done using DATETRUNC('month', DATEADD('month', 1, [Order Date])). Then, the average difference in days between the order date and the shipping date is calculated using AVG(DATEDIFF('day', [Order Date], [Calc1])). This approach ensures that the average wait time is calculated in days, which is the most precise measure for this scenario.
To calculate the average waiting days from order placement to shipping, where shipping occurs on the first day of the following month:
Calculate Shipping Date (Calc1): Use the DATEADD function to add one month to the order date, then apply DATETRUNC to truncate this date to the first day of that month. This represents the shipping date for each order.
Calculate Average Wait Time (Calc2): Use DATEDIFF to calculate the difference in days between the original order date and the calculated shipping date (Calc1). Then, use AVG to average these differences across all orders, giving the average number of days customers wait before their products are shipped.
References:
Date Functions in Tableau: Functions like DATEADD, DATETRUNC, and DATEDIFF are used to manipulate and calculate differences between dates, crucial for creating metrics that depend on time intervals, such as customer wait times in this scenario.
Gladys
2 months agoTwanna
3 months agoMitsue
3 months agoDorinda
3 months agoOzell
3 months agoAnnett
3 months agoFloyd
4 months agoSantos
4 months agoNidia
4 months agoMalcom
4 months agoRachael
5 months agoStaci
5 months agoRhea
5 months agoNaomi
5 months agoTiera
6 months agoIvory
6 months ago