Hey so I checked all your outputs with:
import "csv"
csvDataAll = "#group,false,false,false,false,false,false,false,false,false,false
#datatype,string,long,string,string,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string
#default,_result,,,,,,,,,
,result,table,_field,_measurement,_start,_stop,_time,_value,device,group
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-01T05:00:00.072312457Z,1,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-01T06:11:45.453103096Z,0,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-02T05:36:21.238081506Z,1,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-02T06:21:22.339241473Z,0,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-05T06:01:36.488892424Z,1,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-05T06:37:37.603137977Z,0,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-06T05:00:00.089555454Z,1,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-06T06:24:17.562319614Z,0,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-06T07:54:20.197190957Z,1,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-06T08:00:00.071937642Z,0,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-08T05:56:34.251154467Z,1,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-08T06:31:35.273882642Z,0,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-08T20:43:45.071382178Z,0,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-13T06:37:47.917563774Z,1,nest,heater
,,0,value,state,2022-02-01T00:00:00Z,2022-02-22T23:59:00Z,2022-02-13T07:19:49.057173718Z,0,nest,heater
"
csvDataPrevious = "#group,false,false,true,true,false,false,true,true,true,true
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string,string,string
#default,last,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,device,group
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-01T05:41:30Z,1,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-01T06:33:20Z,0,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-02T05:52:50Z,1,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-02T06:44:40Z,0,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-05T06:26:50Z,1,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-05T07:18:40Z,0,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-06T05:46:20Z,1,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-06T06:38:10Z,0,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-06T08:21:50Z,0,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-08T06:09:00Z,1,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-08T07:00:50Z,0,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-08T20:50:10Z,0,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-13T07:05:40Z,1,value,state,nest,heater
,,0,2022-02-01T04:00:00Z,2022-02-14T03:00:00Z,2022-02-13T07:57:30Z,0,value,state,nest,heater
"
csvDataCurrent = "#group,false,false,true,true,false,false,true,true,true,true,true
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,boolean,string,string,string,string,string
#default,last,,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,device,group,sid
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T14:09:59.28Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T14:44:51.77Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T15:19:44.26Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T15:54:36.75Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T16:29:29.24Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T17:04:21.73Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T17:39:14.22Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T18:14:06.71Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T18:48:59.2Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T19:23:51.69Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T19:58:44.18Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T20:33:36.67Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T21:08:29.16Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-14T21:43:21.65Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-15T05:16:44.02Z,true,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-15T06:26:29Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-15T12:50:06.39Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-15T13:24:58.88Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-15T17:29:06.31Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-15T21:33:13.74Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-16T05:06:36.11Z,true,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-16T06:16:21.09Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-16T10:55:21.01Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-17T11:54:58.08Z,false,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-19T07:30:34.83Z,true,value,state,nest,heater,nest_state
,,0,2022-02-14T04:00:00Z,2022-02-22T21:14:56.461Z,2022-02-19T08:05:27.32Z,false,value,state,nest,heater,nest_state
"
all = csv.from(csv: csvDataAll)
|> count()
|> yield(name: "all")
current = csv.from(csv: csvDataCurrent)
|> count()
|> toInt()
|> yield(name: "current")
previous = csv.from(csv: csvDataPrevious)
|> count()
|> yield(name: "previous")
checkAll = union(tables: [current, previous])
|> group()
|> sum()
|> yield(name: "check all")
You can see the result of checkAll has the same number as values as previous + current combined.
So you should be able to do:
from(bucket: "log/autogen")
|> range(start: 2022-02-01T00:00:00Z, stop: 2022-02-22T23:59:00Z)
|> group()
|> toInt()
To get all the values as shown above.