# Help needed with a influx query

**URL:** <https://community.influxdata.com/t/help-needed-with-a-influx-query/23539>\
**Category:** Fluxlang\
**Tags:** influxdb, flux\
**Created:** [January 26, 2022, 7:45am UTC](https://community.influxdata.com/t/help-needed-with-a-influx-query/23539 "2022-01-26T07:45:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![schama](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/schama/32/9334_2.png) [@schama](https://community.influxdata.com/u/schama)\
**Post date:** [January 26, 2022, 7:45am UTC](https://community.influxdata.com/t/help-needed-with-a-influx-query/23539/1 "2022-01-26T07:45:00Z")

</div>

Dear community,

i have data which i have saved in the following pastebin as example:  
[https://pastebin.com/GUseDaTF](https://pastebin.com/GUseDaTF)

I want to make a graph the number of calls in the time period.

As you see the calls are recorded every minute and therefore the call id (DestinationAlias) occurs multiple times.  
I would like to chart it with windowperiod or something like that.

There is my code with what i came up for now:

```auto
import "strings"
from(bucket: "CMSData")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "expressway_calls")
  |> filter(fn: (r) => r["_field"] == "DestinationAlias")
  |> filter(fn:(r) => strings.hasSuffix(v: r["_value"], suffix: "company@m.webex.com" ))
  |> window(every: 5m)
  |> unique()
  |> count()

```

I would like to have an output like the following:

```auto
| _start | _stop | NumberOfCalls |
|----------------------|----------------------|---------------|
| 2022-01-19T11:05:00Z | 2022-01-19T11:10:00Z | 4 |
| 2022-01-19T11:10:00Z | 2022-01-19T11:15:00Z | 7 |
| | | 9 |

```

Could somebody point me in the right direction?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![schama](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/schama/32/9334_2.png) [@schama](https://community.influxdata.com/u/schama)\
**Post date:** [January 26, 2022, 2:20pm UTC](https://community.influxdata.com/t/help-needed-with-a-influx-query/23539/2 "2022-01-26T14:20:13Z")

</div>

I get results that look like the solution for my problem with the following query:

```auto
import "strings"
from(bucket: "CMSData")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "expressway_calls")
  |> filter(fn: (r) => r["_field"] == "DestinationAlias")
  |> filter(fn:(r) => strings.hasSuffix(v: r["_value"], suffix: "company@m.webex.com" ))
  |> group()
  |> aggregateWindow(every: 15m,fn: (column, tables=<-) => tables
  |> distinct() |> count())

```

Could somebody tell me if this is the best practice for my problem?
