Kapacitor query inside other

i wanna create query based in other query result
it looks like i wanna have two batches the last one depend on first one value