8 Replies Latest reply on Jan 30, 2018 2:24 PM by Mel Buckner

# Need a running average that shows up like a total....

First image is how my data is now.  Second images is of what I need - eg, I need a line, below my monthly total row that shows a running average - but I don't need to see the day over day of that running average (Image #3).  Using a quick table calc, I got it to perform the running average - essentially the patient census / number of days showing, but I can only get it to display as an additional column and this will be confusing to 99% of my consumers.

My dr's are asking me to insert an average (essentially a running average) but I need it to show up as a row beneath the total row (re the image above).

Is there a way to make this happen?

This is how I used to do it in Excel, pre-tableau.  If total visits are column c, and 12/1/2017 as row 2 =average(c2:c33)

• ###### 1. Re: Need a running average that shows up like a total....

Hi

here is a solution

2 formula - don't be afraid by the first one - this just fixes the daily sales

and the second this one calculates the daily average (each day the count is 1 but in the total all are counted)

It returns this for superstore data

• ###### 2. Re: Need a running average that shows up like a total....

Forgive me for being obtuse -….I understand the formulas – but I don’t see how this fixes my display problem?

• ###### 3. Re: Need a running average that shows up like a total....

Hi Mel,

Find my approach based on UNION as reference below and stored in attached workbook version 10.3 located in the original thread

1. Define a union

1. D1. Dimension:

if [Table Name]="Sheet1" then str([date])

elseif [Table Name]="Sheet1\$" then "Monthly Total"

elseif [Table Name]="Sheet11" then "Daily Average"

end

2. M1. Values:

if attr([Table Name])="Sheet1" then sum(value)

elseif attr([Table Name])="Sheet1\$" then window_sum(sum([value]))

elseif attr([Table Name])="Sheet11" then avg(value)

end

3. Drag the required objects to the indicated locations

Regards,

Norbert

• ###### 4. Re: Need a running average that shows up like a total....

I think this might be the solution I've been looking for - BUT, I'm unable to download the .twbx you attached.  Can you resend that file?  I'm a little bit confused on the solution in your on your answer, but I feel like if I can see the workbook I might understand better...Norbert Maijoor

• ###### 5. Re: Need a running average that shows up like a total....

Hi Mel,

On which version are you? I stored the attached workbook in version 10.3

Regards,

Norbert

• ###### 6. Re: Need a running average that shows up like a total....

Ah that might be it – we’re running 10.2.8

• ###### 7. Re: Need a running average that shows up like a total....

Hi Mel,

Find attached workbook in version 10.2

Hope it helps..

Regards,

Norbert

• ###### 8. Re: Need a running average that shows up like a total....

You rock – thanks.  I’ll dig into it momentarily.