7.9 Accumulation for continuous occurrence of a certain condition


There is a statistical table for daily sales:


We want to add a column to the right to calculate the cumulative days of consecutive rising (calculate in cell C1):

1 =0
2 return E(‘A1:B32’).new(if(Sales>Sales[-1], A1=A1+1,A1=0):RiseDayCount)

A2: Take A1 as a temporary value. A1 plus 1 when the sales volume rises, and assign A1 to 0 when the sales volume falls.