title: In Amazon Cloudwatch Insights, how do you take a statistic of a statistic?
body: <p>I am using AWS Cloudwatch Insights and running a query like this:</p>
  <pre><code>fields @message, @timestamp
  | filter strcontains(@message, &quot;Something of interest happened&quot;)
  | stats count() as interestCount by bin(10m) as tenMinuteTime
  | stats max(interestCount) by datefloor(tenMinuteTime, 1d)
  </code></pre>
  <p>However, on the last line, I get the following error:</p>
  <pre><code>mismatched input 'stats' expecting {K_PARSE, K_SEARCH, K_FIELDS, K_DISPLAY, K_FILTER, K_SORT, K_ORDER, K_HEAD, K_LIMIT, K_TAIL}
  </code></pre>
  <p>It would seem to mean from this that I cannot take multiple layers of stat queries in Insights, and thus cannot take a statistic of a statistic. Is there a way around this?</p>