I'm struggling to pass accumulated values to a msgraph object. The graph shows the accumulated values for profit. Look at the attachment, livetrades_form.pdf, to see what I try to achieve. This one works. But when I change to another result set, something wrong happens, attachment livetrades_form_not_correct_pdf.
See the table which the query extracts data form in livetrades_table.pdf.
When showing the form, the Graph's RowSource property is set:
ProfitGraph.RowSource = "SELECT Null, (SELECT sum(Profit) from LiveTrades a2 where a1.ExitTime >= a2.ExitTime) AS RunningSumField1 FROM LiveTrades AS a1 WHERE AlgoVariantID=" & lstAlgoVariant & " GROUP BY a1.ExitTime, a1.LiveTradesID ORDER BY a1.ExitTime ;".
When the lstAlgoVariant (Listbox) returns 1, the graph is correct. When it Returns 12, it's not. The msgraph_query.pdf shows the statement which returns the wrong values. It returns two rows of data, the first one is 367,98 and the second one 212,08. Looking at the table, it seems like the first row with another Algovariant than 12 is counted in, and what happens next, I can't understand....
I would be happy to have some help to make the right statement to send to the graph object.