Categories
Mastering Development

Calculate Number of Consecutive Days Where a Condition Applies Across Two Columns

I have a table similar to below: +————————-+ ¦ ID ¦ Date ¦ Balance ¦ ¦—-+———-+———¦ ¦ A ¦ 20200620 ¦ 150 ¦ ¦—-+———-+———¦ ¦ A ¦ 20200621 ¦ -130 ¦ ¦—-+———-+———¦ ¦ A ¦ 20200621 ¦ -140 ¦ ¦—-+———-+———¦ ¦ A ¦ 20200621 ¦ -200 ¦ ¦—-+———-+———¦ ¦ A ¦ 20200622 ¦ 200 ¦ […]