title: Differences by date for "unpivoted" dataset in Google Data Studio
body: <p>Good afternoon:
  I need to find a way to calculate the numerical differences between rows for specific categories in Google Data Studio, for a dataset that is formatted as a database, with dates, categories and numerical measures.</p>
  <p>I have my data in a &quot;unpivoted&quot; table with date, category and value of this type:
  <a href="https://i.stack.imgur.com/m6zgC.png" rel="nofollow noreferrer">unpivot data</a></p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Fecha</th>
  <th>Activo</th>
  <th>Precio</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>3/01/2020</td>
  <td>AAPL</td>
  <td>572,00</td>
  </tr>
  <tr>
  <td>3/01/2020</td>
  <td>NFLX</td>
  <td>1.571,50</td>
  </tr>
  <tr>
  <td>3/01/2020</td>
  <td>NOKA</td>
  <td>293,00</td>
  </tr>
  <tr>
  <td>3/01/2020</td>
  <td>TECO2</td>
  <td>163,45</td>
  </tr>
  <tr>
  <td>6/01/2020</td>
  <td>AAPL</td>
  <td>582,50</td>
  </tr>
  <tr>
  <td>6/01/2020</td>
  <td>NFLX</td>
  <td>1.650,00</td>
  </tr>
  <tr>
  <td>6/01/2020</td>
  <td>NOKA</td>
  <td>304,50</td>
  </tr>
  <tr>
  <td>6/01/2020</td>
  <td>TECO2</td>
  <td>167,70</td>
  </tr>
  <tr>
  <td>7/01/2020</td>
  <td>AAPL</td>
  <td>581,38</td>
  </tr>
  <tr>
  <td>7/01/2020</td>
  <td>NFLX</td>
  <td>1.645,00</td>
  </tr>
  <tr>
  <td>7/01/2020</td>
  <td>NOKA</td>
  <td>310,00</td>
  </tr>
  <tr>
  <td>7/01/2020</td>
  <td>TECO2</td>
  <td>168,15</td>
  </tr>
  <tr>
  <td>8/01/2020</td>
  <td>AAPL</td>
  <td>587,25</td>
  </tr>
  <tr>
  <td>8/01/2020</td>
  <td>NFLX</td>
  <td>1.650,00</td>
  </tr>
  <tr>
  <td>8/01/2020</td>
  <td>NOKA</td>
  <td>316,50</td>
  </tr>
  <tr>
  <td>8/01/2020</td>
  <td>TECO2</td>
  <td>170,35</td>
  </tr>
  <tr>
  <td>9/01/2020</td>
  <td>AAPL</td>
  <td>603,38</td>
  </tr>
  <tr>
  <td>9/01/2020</td>
  <td>NFLX</td>
  <td>1.658,00</td>
  </tr>
  <tr>
  <td>9/01/2020</td>
  <td>NOKA</td>
  <td>318,00</td>
  </tr>
  <tr>
  <td>9/01/2020</td>
  <td>TECO2</td>
  <td>171,80</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>That is to say: there are several time series in database format with records.</p>
  <p>I need to calculate the daily changes for each category, that is: for each category, the difference with the previous day. In this way:
  <a href="https://i.stack.imgur.com/HsglC.png" rel="nofollow noreferrer">unpivot data with daily difference for each category</a></p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Fecha</th>
  <th>Activo</th>
  <th>Precio</th>
  <th></th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>3/01/2020</td>
  <td>AAPL</td>
  <td>572,00</td>
  <td>0</td>
  </tr>
  <tr>
  <td>3/01/2020</td>
  <td>NFLX</td>
  <td>1.571,50</td>
  <td>0</td>
  </tr>
  <tr>
  <td>3/01/2020</td>
  <td>NOKA</td>
  <td>293,00</td>
  <td>0</td>
  </tr>
  <tr>
  <td>3/01/2020</td>
  <td>TECO2</td>
  <td>163,45</td>
  <td>0</td>
  </tr>
  <tr>
  <td>6/01/2020</td>
  <td>AAPL</td>
  <td>582,50</td>
  <td>10,50</td>
  </tr>
  <tr>
  <td>6/01/2020</td>
  <td>NFLX</td>
  <td>1.650,00</td>
  <td>78,50</td>
  </tr>
  <tr>
  <td>6/01/2020</td>
  <td>NOKA</td>
  <td>304,50</td>
  <td>11,50</td>
  </tr>
  <tr>
  <td>6/01/2020</td>
  <td>TECO2</td>
  <td>167,70</td>
  <td>4,25</td>
  </tr>
  <tr>
  <td>7/01/2020</td>
  <td>AAPL</td>
  <td>581,38</td>
  <td>-1,12</td>
  </tr>
  <tr>
  <td>7/01/2020</td>
  <td>NFLX</td>
  <td>1.645,00</td>
  <td>-5,00</td>
  </tr>
  <tr>
  <td>7/01/2020</td>
  <td>NOKA</td>
  <td>310,00</td>
  <td>5,50</td>
  </tr>
  <tr>
  <td>7/01/2020</td>
  <td>TECO2</td>
  <td>168,15</td>
  <td>0,45</td>
  </tr>
  <tr>
  <td>8/01/2020</td>
  <td>AAPL</td>
  <td>587,25</td>
  <td>5,87</td>
  </tr>
  <tr>
  <td>8/01/2020</td>
  <td>NFLX</td>
  <td>1.650,00</td>
  <td>5,00</td>
  </tr>
  <tr>
  <td>8/01/2020</td>
  <td>NOKA</td>
  <td>316,50</td>
  <td>6,50</td>
  </tr>
  <tr>
  <td>8/01/2020</td>
  <td>TECO2</td>
  <td>170,35</td>
  <td>2,20</td>
  </tr>
  <tr>
  <td>9/01/2020</td>
  <td>AAPL</td>
  <td>603,38</td>
  <td>16,13</td>
  </tr>
  <tr>
  <td>9/01/2020</td>
  <td>NFLX</td>
  <td>1.658,00</td>
  <td>8,00</td>
  </tr>
  <tr>
  <td>9/01/2020</td>
  <td>NOKA</td>
  <td>318,00</td>
  <td>1,50</td>
  </tr>
  <tr>
  <td>9/01/2020</td>
  <td>TECO2</td>
  <td>171,80</td>
  <td>1,45</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p><strong>I need to get the daily differences for each category</strong> in the last 10 or 20 days. Whether it's in a simple table, card, or graph, it doesn't matter, I just need to get those measurements, <strong>like the ones in the fourth column</strong>.</p>
  <p>Needless to say, this is easy to do in a spreadsheet, or with Python or R. Even in Power BI it can be done with DAX. But I need to do it in Google Data Studio.</p>
  <p>I take the data from Google Sheets directly. Here is the original dataset: <a href="https://docs.google.com/spreadsheets/d/1VBjpx0I6RcqaPPNkwxxNukkRIqtzZmgobmyV6OoJCVo/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/1VBjpx0I6RcqaPPNkwxxNukkRIqtzZmgobmyV6OoJCVo/edit?usp=sharing</a></p>
  <p>I've tried calculated fields, measures, and functions, but I can't get anywhere near the solution. I don't know the formulas to do operations between rows. That's why I think maybe it would be better to pivot the table with one column for each stock; although I think it would be more correct to use the raw dataset and try to do it in Data Studio, since I need to learn how to use it because my current job prefers this to Power BI and Tableau.</p>
  <p>That's why I would like to know if there is any way to do it within Google Data Studio</p>
  <p>Thank you very much to all.</p>