title: Grafana + InfluxDB Flux - query for displaying multi-select variable inputs
body: <p>We've set up a Grafana cloud + InfluxDB 2.0 (Flux language) cloud instance. As part of this, we've created a custom variable list with &quot;device IDs&quot;, called <code>devices</code>.</p>
  <p>In a panel, we wish to display parameter data where the user can select one or more device IDs from the <code>devices</code> list to have them displayed in the panel. This works fine for single device ID selection, but not for multiple devices.</p>
  <p>How should the query be modified to display data from a variable number of devices based on a multi-select entry in the dropdown in Grafana?</p>
  <pre><code>from(bucket: &quot;test-bucket-new&quot;)
    |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |&gt; filter(fn: (r) =&gt; r[&quot;_measurement&quot;] == &quot;${devices}&quot;)
    |&gt; filter(fn: (r) =&gt; r[&quot;_field&quot;] == &quot;Speed&quot;)
    |&gt; aggregateWindow(every: v.windowPeriod, fn: mean)
    |&gt; yield(name: &quot;mean&quot;)
  </code></pre>