Published: 29 Jun 2023 Last Modified Date: 04 Jul 2023
Question
How to calculate the average count per day (not the totals)for the year and month? For example:
Environment
Tableau Desktop
Answer
1. Create a date parameter. 2. Create custom dates fields for year/month/day. 3. Create a calculated field. name: TS_order_date value: IF [date type]=1 THEN [Order Date (Years)] ELSEIF [date type]=2 THEN [Order Date (Months)] ELSEIF [date type]=3 THEN [Order Date (Days)] END 4. Create a calculated field. name: TS_count(orders) value: COUNT([Orders])/COUNTD([Order Date]) 5. Drag the [TS_order_date] to the column and set it as discrete, and drag [TS_count(orders)] to the row. 6. Right-click the [date type] parameter and select [show parameter]. Select different values to check the results.
See the attached workbook.
Thank you for providing your feedback on the effectiveness of the article.