title: How can I query range prometheus increase group by time step?
body: <p>I have a counter in prometheus .it always increases.I want to get the growth rate over time
  i use query_range get this data</p>
  <pre><code>query_range?query=sum(msf_nginx_http_requests_total{msf_cluster=&quot;cluster01&quot;, msf_service =~ &quot;api-apm-apm-cluster01&quot;})&amp;start=1649916044.036&amp;end=1649919644.036&amp;step=120
  
  </code></pre>
  <pre><code>{
      &quot;status&quot;: &quot;success&quot;,
      &quot;data&quot;: {
          &quot;resultType&quot;: &quot;matrix&quot;,
          &quot;result&quot;: [
              {
                  &quot;metric&quot;: {},
                  &quot;values&quot;: [
                      [
                          1649916044.036,
                          &quot;4576235&quot;
                      ],
                      [
                          1649916164.036,
                          &quot;4576707&quot;
                      ],
                      [
                          1649916284.036,
                          &quot;4577098&quot;
                      ],
                      [
                          1649916404.036,
                          &quot;4577258&quot;
                      ],
                      [
                          1649916524.036,
                          &quot;4577469&quot;
                      ],
                      [
                          1649916644.036,
                          &quot;4577741&quot;
                      ],
                      [
                          1649916764.036,
                          &quot;4577852&quot;
                      ],
                      [
                          1649916884.036,
                          &quot;4578069&quot;
                      ]
                  ]
              }
          ]
      }
  }
  </code></pre>
  <p>I want to get the increase in data for each time period compared to the previous time period.
  but if use increase function ,i will get that data</p>
  <pre><code>query_range?query=sum(increase(msf_nginx_http_requests_total{msf_cluster=&quot;cluster01&quot;, msf_service =~ &quot;api-apm-apm-cluster01&quot;}[1h]))&amp;start=1649916044.036&amp;end=1649919644.036&amp;step=120
  </code></pre>
  <pre><code>{
      &quot;status&quot;: &quot;success&quot;,
      &quot;data&quot;: {
          &quot;resultType&quot;: &quot;matrix&quot;,
          &quot;result&quot;: [
              {
                  &quot;metric&quot;: {},
                  &quot;values&quot;: [
                      [
                          1649916044.036,
                          &quot;7621.03448275862&quot;
                      ],
                      [
                          1649916164.036,
                          &quot;7721.379310344828&quot;
                      ],
                      [
                          1649916284.036,
                          &quot;7925.172413793102&quot;
                      ],
                      [
                          1649916404.036,
                          &quot;7878.620689655173&quot;
                      ],
                      [
                          1649916524.036,
                          &quot;7897.241379310345&quot;
                      ],
                      [
                          1649916644.036,
                          &quot;7986.206896551724&quot;
                      ],
                      [
                          1649916764.036,
                          &quot;7878.620689655172&quot;
                      ]
                  ]
              }
          ]
      }
  }
  </code></pre>
  <p>How do I need to write a query statement?
  i want get the data just like this:</p>
  <pre><code>{
      &quot;status&quot;: &quot;success&quot;,
      &quot;data&quot;: {
          &quot;resultType&quot;: &quot;matrix&quot;,
          &quot;result&quot;: [
              {
                  &quot;metric&quot;: {},
                  &quot;values&quot;: [
                      [
                          1649916044.036,
                          &quot;10&quot;
                      ],
                      [
                          1649916164.036,
                          &quot;8&quot;
                      ],
                      [
                          1649916284.036,
                          &quot;9&quot;
                      ],
                      [
                          1649916404.036,
                          &quot;5&quot;
                      ],
                      [
                          1649916524.036,
                          &quot;2&quot;
                      ],
                      [
                          1649916644.036,
                          &quot;11&quot;
                      ],
                      [
                          1649916764.036,
                          &quot;8&quot;
                      ],
                      [
                          1649916884.036,
                          &quot;0&quot;
                      ]
                  ]
              }
          ]
      }
  }
  </code></pre>
  <p>The value of the next time period is the increment relative to the previous time interval</p>