Hi, This is an Advanced problem in M language with a very simple excel formula solution.
And after many tryouts with many codes I am kindly asking for Help, please
Here are the basic example of excel files explaining the problem statement
And here are the formulas
So far the solution closest to the problem was described here yet I could not tweak this code to make it works as its over two different rows to compare
https://www.mrexcel.com/board/threads/power-query-grouped-running-totals-with-a-maximum-condition-and-a-verifier.1186541/
Please Help