Kapacitor Join issue - returns empty

I’m trying to make a join between two batches but it’s not working and I can’t figure why

var meanw = batch
|query(‘’’ SELECT mean as value FROM “metrics”.“default”.“mean_week_1h” ‘’')
.period(2d)
.every(10s)

will return this result:

time value
---- ----
2019-02-11T01:00:00Z 1987.604285714286

var current_val = batch │
|query(‘’’ SELECT FIRST(“value”) as value FROM “metrics”.“default”.“daily_perf” where “network” = ‘A’ AND “measure” = ‘measure’ ORDER BY “time” DESC LIMIT 1’‘’)
.period(1d)
.every(10s)
.groupBy(time(1d, 1h))

current_val result is:

time value
---- -----
2019-02-12T01:00:00Z 2019.26

now the merge:

current_val
|join(meanw)
.as(‘current_val’, ‘meanw’)
.tolerance(1w)
|influxDBOut()
.database(‘metrics’)
.measurement(‘joined_measurement’)

now I see the time is different so I added a tolerance to the join but still the joined measurement is not written in influx. I assume because of empty result of the join.

Can anyone help me please?

The documentation explains it well. You need to group by time with the same interval and fill in both queries.