KNOWLEDGE BASE

Average count per day for year and month


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:
User-added imageUser-added image

Environment

  • Tableau Desktop

Answer

1. Create a date parameter.
User-added imageUser-added image
2. Create custom dates fields for year/month/day.
User-added image
User-added imageUser-added imageUser-added image
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.

 
Did this article resolve the issue?