With the help of table calculation, moving average can be easily calculation in Tableau. But do you know that you can make the calculation interactive by creating a parameter to change the months of moving average? In this blog, I will walk you through on how to do that!
Before creating a calculation with parameter, we need to first understand what do we have to specify when creating moving average with quick table calculation, as we would need to do the same in a calculated field.
As shown in the image above, we need to specify the numbers of months used, whether we want to include the current value and whether we want to null the months that do not have enough values.
The first step is to create a parameter. The data type should be set to integer, and the range of values will represent the numbers of months. The parameter is then ready to be used in a calculation.
The image above explained how the calculation is formulated. And in the 'Default Table Calculation', you can set whether you want the months with not enough values to be null.
I hope you find this instruction helpful. Let me know if you want more explaination on this.