# Flux language sampling example

**URL:** <https://community.influxdata.com/t/flux-language-sampling-example/14639>\
**Category:** Fluxlang\
**Tags:** time-series, flux\
**Created:** [June 2, 2020, 6:14pm UTC](https://community.influxdata.com/t/flux-language-sampling-example/14639 "2020-06-02T18:14:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmatesunny](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/gmatesunny/32/4971_2.png) [@gmatesunny](https://community.influxdata.com/u/gmatesunny)\
**Post date:** [June 2, 2020, 6:14pm UTC](https://community.influxdata.com/t/flux-language-sampling-example/14639/1 "2020-06-02T18:14:01Z")

</div>

I have a datestamp and **value** columns in my measurement. The datestamp is **not** evenly distributed and on minute-wise. I want to resample/granulize on per day basis [commulative]  
I want to find the flux language query for resampling. Could someone give an example with description?

PS: I am very new to flux language.

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [June 8, 2020, 3:38pm UTC](https://community.influxdata.com/t/flux-language-sampling-example/14639/2 "2020-06-08T15:38:57Z")

</div>

@gmatesunny [`aggregateWindow()`](https://docs.influxdata.com/flux/v0.65/stdlib/built-in/transformations/aggregates/aggregatewindow/) is what you’re looking for.

The following will return the daily average of the `value` field.

```javascript
from(bucket: "db/rp")
  |> range(start: -7d)
  |> filter(fn: (r) => r._measurement == "example-measurement" and r._field == "value")
  |> aggregateWindow(every: 1d, fn: mean)

```
