To be clear on what I'm trying to achieve is to roll up every 20th from the start.
Assuming the fact the person leaves at every 20th day, no. of people leaves creates the vacant for next day (21st Day). Thats the reason why the Flag column is created to rolling down the values every 20 days.
Hope the above logic description is understandable.
As I explained in the header example, I need to accumulate the values of the 3rd record respectively. The expression suggested is working fine in the provided sample file.
When I tried to apply the same in the application(recently attached qvf) in which I'm working on. The expression isn't working correctly as expected.
In the previous reply, I tried to explain the business behind the logic I'm working on. If open the qvf, the patient admitted is the same, for 1st cycle which is 1-20 days, when the next cycle starts, 1st cycle patient moves away and beds occupied by them is assigned to the person comes in 2nd cycle (21-40 days). Likewise, it goes on till the date entered in the data.