score:2

Accepted answer

rangebetween considers the actual values in the column. it will check which values are "in range" (including both start and end values). in your example, the current row is the start value and next row is the end value. since the range is inclusive, all duplicate values will be counted as well.

for example, if the start and end values are 1 and 3 respectively. all values in this range (1,2,3) will be used in the sum.


this is in contrast to rowsbetween. for this function, only the specified rows are counted. i.e., rowsbetween(window.currentrow, 1) will only consider the current and next rows, whether duplicates exists or not.

score:0

i would guess that for the same id in the same category,these same ids(here, the id is 1,the category is a) are calculated together...,that is:

for two same ids in the same category:

  1. sum up all the same ids, here, it is 1+1

  2. for these same ids, their next id is the one that is different to them, here it is 2, then the sum is 1+1+2

not sure my understanding is correct


Related Query

More Query from same tag