<aside> <img src="/icons/megaphone_yellow.svg" alt="/icons/megaphone_yellow.svg" width="40px" /> Update: thanks to Stéphane Larzet for solving this problem!

</aside>

<aside> <img src="/icons/report_lightgray.svg" alt="/icons/report_lightgray.svg" width="40px" /> Problem

I need to walk my dog every day, and I track this habit with checkboxes. If I checked the box 10 days in a row, the formula would calculate 10, but then if the 11th day I didn’t, it would reset to 0 and start counting again.

</aside>

Habits

Months

Formula

if(
    contains(prop("Habits").map(current.prop("Walking the dog")),false),
        /* 5. Filter to keep only past dates */
        filter(prop("Habits").map(current.prop("Date")), current >
        /* 4. Keeping only the last one */
        last(
              /* 1. Rows where I didn't walk the dog */
              filter(prop("Habits"),current.prop("Walking the dog")==false)
              /* 2. Ascending sorting */
              .sort()
        )
        /* 3. Getting the related date */
        .prop("Date") )
        /* Counting the number of concerned dates */
        .length(),
prop("Habits").length() )