# aggregateWindow for incomplete timeframes

**URL:** https://community.influxdata.com/t/aggregatewindow-for-incomplete-timeframes/19456
**Category:** InfluxDB 2
**Tags:** influxdb
**Created:** [April 18, 2021, 8:37am UTC](https://community.influxdata.com/t/aggregatewindow-for-incomplete-timeframes/19456 "2021-04-18T08:37:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![astrakid](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/astrakid/32/6917_2.png) [@astrakid](https://community.influxdata.com/u/astrakid)
#### Post date: [April 18, 2021, 8:37am UTC](https://community.influxdata.com/t/aggregatewindow-for-incomplete-timeframes/19456/1 "2021-04-18T08:37:49Z")

</div>

hi,  
i am using influx 2.0 oss and want to achieve the following:  
aggregate data per month

this should be an easy task, but i only get data for completed months.  
e.g. i have data from 2021-03-09 until today. with my query i only get data for march. what i want is to get data for the current month displayed as well. that doesn’t work. any hint?

my query:

```
rawSeries=from(bucket: "test")
|> range(start: -1y)
|> filter(fn: (r) => r["_measurement"] == "data")
|> filter(fn: (r) => r["_field"] == "value")
|> filter(fn: (r) => r["type"] == "Export")
|> aggregateWindow(every: 1d, fn: first, timeSrc: "_start")
|> difference()
|> timeShift(duration: -2h1s)
namedSeries = rawSeries
    |> map(fn: (r) => ({_value:r._value, _time:r._time,_type:r.type, _field:"erzeugte Leistung "+r.type}))
namedSeries |> yield()

```

but this gives me just one row:  
result  
table  
\_field  
\_time  
\_type  
\_value

```
0
erzeugte Leistung Export
2021-03-31T21:59:59Z
Export
1002.9200000000001

```

what am i doing wrong?

---

<div class="post-metadata">

### Author: ![MzazM](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@MzazM](https://community.influxdata.com/u/MzazM)
#### Post date: [April 19, 2021, 9:33am UTC](https://community.influxdata.com/t/aggregatewindow-for-incomplete-timeframes/19456/2 "2021-04-19T09:33:33Z")

</div>

I think it is due to the fact that first is a selector and not an aggregator. If you try with mean, does it work as expected? obviously this is not what you want but it could bring you to the right path. If this is the issue you could follow what written here: [aggregateWindow with create empty inconsistent behavior · Issue #3428 · influxdata/flux · GitHub](https://github.com/influxdata/flux/issues/3428)

---

<div class="post-metadata">

### Author: ![astrakid](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/astrakid/32/6917_2.png) [@astrakid](https://community.influxdata.com/u/astrakid)
#### Post date: [April 19, 2021, 12:56pm UTC](https://community.influxdata.com/t/aggregatewindow-for-incomplete-timeframes/19456/3 "2021-04-19T12:56:11Z")

</div>

no, with “mean” it looks the same. only difference is further rows in the past.  
but april is still not shwoing up.
