title: Power BI: CALCULATE SUM but with several filters and joins?
body: <p>I'm stuck now at some point.
  Here's the situation:</p>
  <p>The data:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: center;">Offset Account Name</th>
  <th style="text-align: center;">AccountNo</th>
  <th style="text-align: center;">Amount</th>
  <th style="text-align: center;">Purpose</th>
  <th style="text-align: center;">Invoice Number</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: center;">Customer1</td>
  <td style="text-align: center;">100</td>
  <td style="text-align: center;">150$</td>
  <td style="text-align: center;">&quot;Customer1/Blahblah&quot;</td>
  <td style="text-align: center;">Inv001</td>
  </tr>
  <tr>
  <td style="text-align: center;">Customer1</td>
  <td style="text-align: center;">100</td>
  <td style="text-align: center;">250$</td>
  <td style="text-align: center;">&quot;Customer1/Meow&quot;</td>
  <td style="text-align: center;">Inv002</td>
  </tr>
  <tr>
  <td style="text-align: center;">Distributor1</td>
  <td style="text-align: center;">200</td>
  <td style="text-align: center;">100$</td>
  <td style="text-align: center;">&quot;Customer1/Inv001&quot;</td>
  <td style="text-align: center;">Inv003</td>
  </tr>
  <tr>
  <td style="text-align: center;">Distributor1</td>
  <td style="text-align: center;">200</td>
  <td style="text-align: center;">150$</td>
  <td style="text-align: center;">&quot;Customer1/Inv002&quot;</td>
  <td style="text-align: center;">Inv004</td>
  </tr>
  <tr>
  <td style="text-align: center;">Distributor1</td>
  <td style="text-align: center;">200</td>
  <td style="text-align: center;">50$</td>
  <td style="text-align: center;">&quot;Customer1/Inv002&quot;</td>
  <td style="text-align: center;">Inv005</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>My Goal? According to the example I need to extract the &quot;InvNoXXX&quot; from the &quot;Purpose&quot; column, match the entries from &quot;Invoice Number&quot; and then calculate the sum.</p>
  <p>The results of the &quot;calculate sum&quot; should be then:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: center;">Offset Account Name</th>
  <th style="text-align: center;">AccountNo</th>
  <th style="text-align: center;">Amount</th>
  <th style="text-align: center;">Purpose</th>
  <th style="text-align: center;">Invoice Number</th>
  <th style="text-align: center;">Distributor</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: center;">Customer1</td>
  <td style="text-align: center;">100</td>
  <td style="text-align: center;"><strong>50</strong>$</td>
  <td style="text-align: center;">&quot;Customer1/Blahblah&quot;</td>
  <td style="text-align: center;">Inv001</td>
  <td style="text-align: center;">Distributor 1</td>
  </tr>
  <tr>
  <td style="text-align: center;">Customer1</td>
  <td style="text-align: center;">100</td>
  <td style="text-align: center;"><strong>50</strong>$</td>
  <td style="text-align: center;">&quot;Customer1/Blahblah&quot;</td>
  <td style="text-align: center;">Inv002</td>
  <td style="text-align: center;">Distributor 1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>As you can see, the each amounts from the distributors have been summarized and then substracted from the according amount of the matched &quot;Invoice Number&quot; from each &quot;Customer-Row&quot;. And as a bonus, I need to show the according distributor in an new column.</p>
  <p>The Point is: The data is currently only imported from an excel file and I'm trying to calculate everything within Power BI. I know how to do it in SQL, but in Power BI I'm lost.</p>
  <p>Any ideas? Is this even possible in Power BI?</p>
  <p>Thanks in advance!</p>