3 Replies Latest reply on Aug 15, 2018 10:07 PM by lei.chen.0

# Find the average value based on the number of weekdays YTD

Hello, I am trying to create a table of the average value over all weekdays every year so it would look like this:

How can we achieve this in Tableau? I am unable to get the correct value for "# of Weekday" and "Average" fields.

The dataset is attached.

Thank you,

-Felix

• ###### 1. Re: Find the average value based on the number of weekdays YTD

Hello Felix,

Yes, this can be achieved like this.

Regards

Lei

1 of 1 people found this helpful
• ###### 2. Re: Find the average value based on the number of weekdays YTD

Thank you Lei. However this method works if there is only one entry per date.

Apology that I should have also mentioned that there could be multiple entries on the same dates. For examples on January 1st, there are four sales (334, 123, 1000000, 2001).

Also for "# of weekdays", I want it to return "the number of weekday (say Tuesday) since the beginning of the year", rather than "the total number of Tuesdays recorded in the dataset for that year".

• ###### 3. Re: Find the average value based on the number of weekdays YTD

Hello Felix,

Apology that I should have also mentioned that there could be multiple entries on the same dates. For examples on January 1st, there are four sales (334, 123, 1000000, 2001).

Also for "# of weekdays", I want it to return "the number of weekday (say Tuesday) since the beginning of the year", rather than "the total number of Tuesdays recorded in the dataset for that year".

Thus, I suppose your your requirement for average sales is 1) first sum sales for each day, 2) take average for all days.

And the logic for weekday count is a totally different one.

I attached a sample workbook, and please check it out for details.

Regards

Lei