Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
pasgalbarra
Partner - Creator
Partner - Creator

Count Previous read

Hi Community,

pasgalbarra_1-1664283257403.png

 

 

I need to count the consecutive times that I have a "e" value, I managed to add the 1/0 value but now I need to sum these values.

I need to count the consecutive times I have a 1, but when I have a 0 I need to start again, any Ideas on how can I do it?

 

Thanks

Labels (1)
1 Solution

Accepted Solutions
rubenmarin

Then set the label of this expression prev_read2 and use:

If(Above(TOTAL START_READ_TYPE)='e',Above(TOTAL [prev_read2])+1,0)

View solution in original post

6 Replies
rubenmarin

Hi, if prev_read is the label of the last expression an is calculated as:

If(Above(TOTAL START_READ_TYPE)='e',1,0)

The accumulation could be:

If(Above(TOTAL START_READ_TYPE)='e',Above(TOTAL [prev_read])+1,0)

It will be flagged as an error but it should work

pasgalbarra
Partner - Creator
Partner - Creator
Author

Hi @rubenmarin ,

 

Thanks for your answer, it;s not working as I expect, as you can see it shows always 2, but I am expecting..3,4,5,6 in these rows

pasgalbarra_1-1664287933408.png

 

 

rubenmarin

This expression was to sustitute the prev_read expression, for this to work this expression needs to be labeles as prev_read, or change the expression and the label so it uses the previous value if this same expression.

It always shows 2 because there is other prev_read expression with 0 or 1.

pasgalbarra
Partner - Creator
Partner - Creator
Author

prev_read is created in the script using:

,If(START_READ_TYPE = 'e' and Peek([START_READ_TYPE]) ='e', 1,0) as prev_read

rubenmarin

Then set the label of this expression prev_read2 and use:

If(Above(TOTAL START_READ_TYPE)='e',Above(TOTAL [prev_read2])+1,0)

pasgalbarra
Partner - Creator
Partner - Creator
Author

@rubenmarin  Thanjs man!