Home > Back-end >  Count current and longest streak from null or 1 values
Count current and longest streak from null or 1 values

Time:05-23

I'm trying to count longest and current streak from null or 1 values in google sheets.

It's going to be used in Data Studio, but I have to make calculation in Sheets.

I've tried a sultion from below post, but it's nor working for me and also I have null values not 0, and it has to stay this way (rows in sheet are being appended from google forms form, where I check whether I did a habit or not). enter image description here


all:

=INDEX(QUERY(LEN(SUBSTITUTE(FLATTEN(TRIM(SPLIT(QUERY(
 IF(A1:A=""; "×"; "¤");;9^9); "×"; ))); " "; )); 
 "where Col1 <> 0"))

enter image description here


last:

=INDEX(QUERY(SORT(LEN(SUBSTITUTE(FLATTEN(TRIM(SPLIT(QUERY(
 IF(A1:A=""; "×"; "¤");;9^9); "×"; ))); " "; )); 
 SEQUENCE(ROWS(A1:A)-COUNTA(A1:A)); 0); "where Col1 <> 0 limit 1"; ))

enter image description here

  • Related