5 Replies Latest reply on Jul 18, 2018 6:25 AM by Patrick Carra

# Calculating the Average by a unique entry in a column

I would like to calculate the average of the Duration by the number of entries.   Another complication is that I have records that have NULL in Date2 that I need to exclude from the calculation.  I have calculated the Duration using DateDIFF('day', [Date1], [Date2]).  My worksheet is set up like this:

Vendor     Date1     Date2     Duration

Any help is greatly appreciated.

• ###### 1. Re: Calculating the Average by a unique entry in a column

Hi Patrick,

We are Ready to help, but we need to see some sample workbook so that we are at same page helping you. Pl do a favor by attaching some simple sample from Superstore or some fake data set.

Thnaks

Deepak

• ###### 2. Re: Calculating the Average by a unique entry in a column

I have attached a csv file that is simplified but similar to the data set I am using.  I also have a much larger data set that I am actually using but cannot share.

• ###### 3. Re: Calculating the Average by a unique entry in a column

Also have created a new Book in Tableau using this data if you would prefer this.

• ###### 4. Re: Calculating the Average by a unique entry in a column

From Your data I Created By Vendor and By Overall, Use whatever you need. When You will Have Null, The Formula Will Change to Exclude Null and Take Only Values That you Need

Thanks

Deepak

If it Helps, Pl mark it Helpful and CORRECT to Close Thread

• ###### 5. Re: Calculating the Average by a unique entry in a column

This is very helpful for some reason when I modify the fields and plug into my workbook it seems that one of the records is not being included in the average calculations.  Any ideas what might cause this?

Overall Average {FIXED:AVG({FIXED [Vendor],[Quote Requested]:SUM([Days Until Received])})}

Average By Vendor {FIXED [Vendor]:AVG({FIXED [Vendor],[Quote Requested]:SUM([Days Until Received])})}