Forecast Balance and Date of such forecast

In a Transaction (Check) Register, I am trying to determine the smallest Balance in the Future and what Date that Smallest Balance occurs …

Calc Test 2.ods

In Google Sheets, the formula is for the smallest balance is … … =query(sort({A4:A,sumif(A4:A,"<="&A4:A,B4:B)},1,true),“select Col2, Col1 where Col1 >= date '” & text(G1,“yyyy-mm-dd”)&"’ order by Col2 asc, Col1 asc limit 1") … … but it does not work in Libre Office.

Answered by Opeque … Thank you