title: Building a portfolio tracker char based on a list of transactions: a formula/approach is incorrect
body: <p>I'm trying to build a chart, which tracks month-to-month portfolio assets:</p>
  <p><a href="https://i.stack.imgur.com/D6Ztv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D6Ztv.png" alt="enter image description here" /></a></p>
  <p>The initial dataset is a basic transaction list (<code>A:G</code>). Next, I'm trying to define a dataset (<code>I:L</code>), where the column <code>I</code> contains first days and <code>J:L</code> columns have actual balances at those moments.</p>
  <p>A <code>J:2</code> formula is:</p>
  <pre><code>=INDEX(array_constrain(filter(SORT($A$2:$G;1;FALSE); $B$2:$B = J$1; $A$2:$A &lt; $I2); 1; 7); 1; 7)
  </code></pre>
  <p>Unfortunately, this does not work as expected. The formula is also quite complicated, so I wish it can be simpler.</p>
  <p>Any help and links are highly appreciated.</p>
  <p><strong>p.s.</strong> If you are not in a personal challenge mode, then I suggest you to look at this portfolio tracker example: <a href="https://investmentmoats.com/stock-market-commentary/portfolio-management/introducing-our-free-stock-portfolio-tracker-spreadsheet/" rel="nofollow noreferrer">https://investmentmoats.com/stock-market-commentary/portfolio-management/introducing-our-free-stock-portfolio-tracker-spreadsheet/</a></p>
  <p><a href="https://i.stack.imgur.com/DN6Vc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DN6Vc.png" alt="enter image description here" /></a></p>