Do you have some dummy data (not 4M rows obviously ) ?
You can probably do this with a calculated field and a LOOKUP function, but it might depend on the structure of the data.
1 of 1 people found this helpful
There are 3 ways you can have blanks in a Tableau view: 1) the data is entirely missing, 2) there are rows in the underlying data source for those dates but that measure is blank, 3) the data is filtered out of the view.
Depending on what caused the blanks, and how the final view is structured, different options are available. See Replace NULL or missing data with zeros
That article talks about replacing the empty value with zeros, but you can also replace it with another value in your view. For example instead of ZN(LOOKUP(...,0)) you could use IFNULL( SUM([Field]), LOOKUP(SUM(Field], -1)) ) which would replace a NULL value with the value of the same field from one partition ago (but if last month was also NULL, then you would be replacing a NULL with a NULL so be careful there)
The downside with LOOKUP() is that you need to know exactly how many columns back you want to go. If instead, you always wanted to use the last valid value, you could use something like IFNULL( SUM([Field]), PREVIOUS_VALUE(0) ). The PREVIOUS_VALUE() function will return the last value of the calculation it is in.
Table calculations can do really cool stuff, but are a bit complex. I recommend reading Transform Values with Table Calculations - Tableau for a deeper understanding!
Hope this helps