Forum Discussion
Anonymous
7 years agoNot applicable
cumulative count based on a key.
Hi there, I have a 'collect key' column and want to provide a number (in sequence) next to it for all trips that have the same key, and for this to repeat for all of the different keys. What...
- 7 years ago
If you can have an extra column with a unique, consecutive numerical ID (index), I think the code below should work. You can add an index column easily in the query editor (see the solution on this post)
Table[Accumulated] = COUNTROWS ( FILTER ( Table; Table[Collect Key] = EARLIER ( Table[Collect Key] ) && Table[ID] <= EARLIER(Table[ID]) ) )
Anonymous
7 years agoNot applicable
I am unsure of how to attach a sample. Hopefully, the amended post will suffice.
Thanks, Shem
AlB
7 years agoCommunity Champion
If you can have an extra column with a unique, consecutive numerical ID (index), I think the code below should work. You can add an index column easily in the query editor (see the solution on this post)
Table[Accumulated] =
COUNTROWS (
FILTER (
Table;
Table[Collect Key] = EARLIER ( Table[Collect Key] )
&& Table[ID] <= EARLIER(Table[ID])
)
)
- Anonymous7 years agoNot applicable
Thanks, it worked perfectly!