'RunningCount/RunningSum Business Objects - how to reset every occurrence of blank

I have a table in Business Objects in which I have created a monthly date spine and I can see how many items a customer bought in a monthly period. What I am trying to do is count the number of months in which no purchases were made and then find the longest gap across the whole date range.

Here is a mock-up in Excel of what I have got so far in Business Objects:

enter image description here

As you can see I have a running count, but it continues counting every time a blank row is encountered. What I want is that the counting would reset every time a new blank entry is found. I could then find the maximum gap across the date range.

What it should look like is:

enter image description here

The formula I have at present is:

=RunningSum(IsNull([monthly_purchase]);([monthly_purchase];[date]))

How can I adapt this to get the result I want?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source