As far as I can see, there is no reason to do these complicated calculations. You can just put counter on rows, and make a simple calculation checking whether a status is critical. Then run a table calculation on these measures. Please find my solution in the attached workbook.
Thanks to Timothy Vermeiren for providing this solution.
Thanks for the reply , would you please attache the twbx so i can check ?
Thanks Wim. That helped me to rethink it again.
Actually i needed to write the running sum function myself in order to use the calculated field in other calculations , like week over week changes.