I have the following flux query that aggregates on a monthly basis
from(bucket: "some-bucket") |> range(start: v.timeRangeStart, stop: v.timeRangeS