title: Can you calculate active users using time series
body: <p>My atomist client exposes metrics on commands that are run. Each command is a metric with a username element as well a status element.</p>
  <p>I've been <strong>scraping</strong> this data for months without resetting the counts.</p>
  <p>My requirement is to show the number of active users over a time period. i.e <code>1h</code>, <code>1d</code>, <code>7d</code> and <code>30d</code> in Grafana.</p>
  <p>The original query was:</p>
  <pre><code>count(count({Username=~&quot;.+&quot;}) by (Username))
  </code></pre>
  <p>this is an issue because I dont clear the metrics so its always a count since inception.</p>
  <p>I then tried this:</p>
  <pre><code>count(max_over_time(help_command{job=“Application
  Name”,Username=~“.+“}[1w]) -
  max_over_time(help_command{job=“Application name”,Username=~“.+“}[1w]
  offset 1w) &gt; 0)
  </code></pre>
  <p>which works but only for one command I have about 50 other commands that need to be added to that count.</p>
  <p>I tried the:</p>
  <pre><code>&quot;{__name__=~&quot;.+_command&quot;,job=&quot;app name&quot;}[1w] offset 1w&quot;
  </code></pre>
  <p>but this is obviously very expensive (timeout in browser) and has issues with integrating <code>max_over_time</code> which doesn't support it.</p>
  <p>Any help, am I using the metric in the wrong way. Is there a better way to query... my only option at the moment is the <code>count</code> (format working above for each command)</p>
  <p>Thanks in advance.</p>