title: Get 1 Year results from TimescaleDB
body: <p>I have a table with data for IoT Devices, sending measurements every hour. Have to get reports for Today, Week, Month and Year.</p>
  
  <p>Using timescaleDB i got some "ok" results for Today, Week and Month. For example Monthly:</p>
  
  <pre><code>   SELECT
        time_bucket('4 weeks', measured_at) AS month,
        MAX(CAST(data-&gt;&gt;'1_8_0' AS DOUBLE PRECISION)) - MIN(CAST(data-&gt;&gt;'1_8_0' AS DOUBLE PRECISION)) as consumption
        FROM readings
        WHERE device_id = 4
        GROUP BY month
        ORDER BY month DESC LIMIT 12;
  </code></pre>
  
  <p>But can not find a good way to fetch values for years? Any one ever tried that?</p>
  
  <p>Year is not supported by timescale, using weeks results in wrong result.</p>
  
  <p>ERROR:  interval defined in terms of month, year, century etc. not supported</p>