title: How to pivot multiple aggregation in Snowflake
body: <p>I have the table structure as below</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>product_id</th>
  <th>Period</th>
  <th>Sales</th>
  <th>Profit</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>x1</td>
  <td>L13</td>
  <td>$100</td>
  <td>$10</td>
  </tr>
  <tr>
  <td>x1</td>
  <td>L26</td>
  <td>$200</td>
  <td>$20</td>
  </tr>
  <tr>
  <td>x1</td>
  <td>L52</td>
  <td>$300</td>
  <td>$30</td>
  </tr>
  <tr>
  <td>x2</td>
  <td>L13</td>
  <td>$500</td>
  <td>$110</td>
  </tr>
  <tr>
  <td>x2</td>
  <td>L26</td>
  <td>$600</td>
  <td>$120</td>
  </tr>
  <tr>
  <td>x2</td>
  <td>L52</td>
  <td>$700</td>
  <td>$130</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I want to pivot the period column over and have the sales value and profit in those columns. I need a table like below.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>product_id</th>
  <th>SALES_L13</th>
  <th>SALES_L26</th>
  <th>SALES_L52</th>
  <th>PROFIT_L13</th>
  <th>PROFIT_L26</th>
  <th>PROFIT_L52</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>x1</td>
  <td>$100</td>
  <td>$200</td>
  <td>$300</td>
  <td>$10</td>
  <td>$20</td>
  <td>$30</td>
  </tr>
  <tr>
  <td>x2</td>
  <td>$500</td>
  <td>$600</td>
  <td>$700</td>
  <td>$110</td>
  <td>$120</td>
  <td>$130</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I am using the snowflake to write the queries. I tried using the <code>pivot</code> function of snowflake but there I can only specify one aggregation function.</p>
  <p>Can anyone help as how I can achieve this solution ?</p>
  <p>Any help is appreciated.</p>
  <p>Thanks</p>