title: Google Data Studio how to calculate sum of only distinct values
body: <p>I have data set which contains work hours and invoices related to these work hours. Some work hours are not related to any invoices yet. Several work hours can be related to a single invoice. Example of data:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Date</th>
  <th>Project</th>
  <th>Hours</th>
  <th>Price of hours</th>
  <th>Invoice</th>
  <th>Invoice total</th>
  <th>Invoice hours</th>
  <th>Invoice others</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2021-05-06</td>
  <td>Project 1</td>
  <td>7.5</td>
  <td>500</td>
  <td>invoice_id_1</td>
  <td>1500</td>
  <td>1200</td>
  <td>300</td>
  </tr>
  <tr>
  <td>2021-05-07</td>
  <td>Project 1</td>
  <td>7.5</td>
  <td>500</td>
  <td>invoice_id_1</td>
  <td>1500</td>
  <td>1200</td>
  <td>300</td>
  </tr>
  <tr>
  <td>2021-05-08</td>
  <td>Project 1</td>
  <td>7.5</td>
  <td>600</td>
  <td>invoice_id_2</td>
  <td>600</td>
  <td>600</td>
  <td>0</td>
  </tr>
  <tr>
  <td>2021-05-09</td>
  <td>Project 1</td>
  <td>2</td>
  <td>100</td>
  <td>invoice_id_1</td>
  <td>1500</td>
  <td>1200</td>
  <td>300</td>
  </tr>
  <tr>
  <td>2021-05-10</td>
  <td>Project 1</td>
  <td>7.5</td>
  <td>550</td>
  <td>null</td>
  <td>null</td>
  <td>null</td>
  <td>null</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I want to create 3 scorecards that shows the total sum of invoices, total sum of invoice hours and total sum of invoice others.</p>
  <p>However, if I simply have SUM(invoice_hours), the sum would in this case be 4200, but I would like it to be 1800 as three of entries are in the same invoice. I could fix this by using Price of hours instead, but that doesn't help with Invoice others.</p>
  <p>So my question is this: is it possible to count the sum of a field, counting rows where another field is not distinct only once? So in this case only counting the first row and third row (ignoring rows 2 and 4 as the invoice_id_1 has already been counted).</p>
  <p>For what it's worth, I'm using a community connector that I created that fetches the data from an API, so I can modify the data format / add fields if it's necessary.</p>