3 Replies Latest reply on Jul 22, 2019 11:12 PM by Hari Ankem

# Last 4 Week Averages in Underlining Data - For any given Date

Hi,

I  got most of the basic Calculated Fields down, however I am trying to compile underlining data from the Data Source and place them on selected names/Time Period that I have assigned and get the same Last 4 Weeks from a date that I have filtered/picked on my excel table.  I have been attempting to get the last 4 weeks of data in the Grand Total, however it's a no go.

- its under "Moving Average of 4 Week Avg Conversion Rate" (last Column) which I am attempting to achieve 10.05 in the grand total.

I was successful in everything else except the 4 week averages.  In Excel, it is: =AVERAGE(T186:T189), for example.

Attached is the Tableau and below is what I am attempting to achieve in the highlighted yellow (last 4 week averages).  For example, I am trying to get 10.05% under "4-Week Ave. Conv Rate".

Thank you for any help!

Ant

• ###### 1. Re: Last 4 Week Averages in Underlining Data - For any given Date

See if this helps:

Updated workbook is attached for reference.

• ###### 2. Re: Last 4 Week Averages in Underlining Data - For any given Date

Thank you!

However what I am trying to achieve is to have the builder names within a given date (in this case, period) and show the moving average of 4 Weeks.  However I am not doing so.  the last column is wrong and in your's, it's right.  My goal is to capture what you did but in this condensed form.  What calculated formula did you use in your example in the last column?  Thanks Again!

• ###### 3. Re: Last 4 Week Averages in Underlining Data - For any given Date

For table calculations to work, we need multiple periods (4) of data in our current scenario.So, it's better that you work with parameters here instead of filters. If you are still bent on working with filters, then you need to ensure that you have a minimum of 4 periods available in the data for the moving calculation to work.

Here is how I would proceed with a period parameter:

1. Create a period parameter and select a period value.

2. Create a calculated field to show/hide the period based on the parameter value selection.

3. Add the above calculated field to the rows, hide the "Hide" values by right-clicking on it and then suppress the header for this field.

4. You should now have the data for the selected period only.

Hope this helps. Updated workbook is attached for reference.