The before() function looks at the previous column in a pivot table. It needs to contain the same formula as the column you are searching within.
See the reference manual page 818 (QV v11 manual), or perform a search for "before(". This says:
before([ total ] expression [ , offset [,n ]])
Returns the value of expression evaluated with a pivot table's dimension values as they appear in the column
before the current column within a row segment in the pivot table. This function returns NULL in all chart
types except pivot tables.
On the first column of a row segment a NULL value will be returned, as there is no column before this one.
If the table is one-dimensional or if the expression is preceded by the total qualifier, the current row segment
is always equal to the entire row.
Say you have two dimensions, Product and month, and one expression, sum(SalesValue), within a pivot table where the second dimension of Month is pivoted so it runs across the top.
I think you can have a test to see if it is ColumnNo(1), and if not then add the contents of before(sum(SalesValue)) to the sum(SalesValue) for the current month that the column relates to. This could look something like this:
Hope that works.