5 Replies Latest reply on Jul 12, 2019 5:38 AM by KALPIT GOYAL

# Calculating avg weekday result / avg month result

Hi all, I'm quite new in using tableau. I'm creating a table like this.

I need to do an average calculation from every sale happens in one weekday divided by avg sales per month.

example :

Average Tuesday sales in January divided with average January sales

In excel I use AVARAGEIFS for it. Hope you can help me.

• ###### 1. Re: Calculating avg weekday result / avg month result

Try this:

AVG( [Sales] )

/

AVG( {FIXED YEAR( [Order Date] ) , MONTH( [Order Date] ) : AVG( [Sales] ) } )

• ###### 2. Re: Calculating avg weekday result / avg month result

Hi Manggala,

According to your use case you want for example:

Average Tuesday sales for January Month in the year 2015 are 363,

Average January sales in the year 2015 are 14237 then you want to divide 363/14237.

If yes, then you have to make a calculated field with FIXED LOD and if not then do let me know the exact scenario.

{ FIXED YEAR([Order Date]),MONTH([Order Date]), DATENAME('weekday',[Order Date]):SUM([Sales])} /

{ FIXED YEAR([Order Date]),MONTH([Order Date]):SUM([Sales])}

This Calculated field gives the desired output. I am attaching my sample workbook too for reference where I used sample superstore data.

Thanks,

Kalpit

1 of 1 people found this helpful
• ###### 3. Re: Calculating avg weekday result / avg month result

You can also put SUM([Sales] only in Numerator. I put { FIXED YEAR([Order Date]),MONTH([Order Date]), DATENAME('weekday',[Order Date]):SUM([Sales])} to generalize the formula irrespective of columns in the views.

• ###### 4. Re: Calculating avg weekday result / avg month result

Definitely what I need. Thanks bro

• ###### 5. Re: Calculating avg weekday result / avg month result

You are welcome