Pass result of one query into another while creating alert rules

Hi. I have a use case where I need to pass the result of one Query(A) into the next one as part of the input. Is that possible?
Use case:
Query ‘A’ is will return the state of objects, active/inactive. I only want to move forward with objects with Active states in the next set of queries/expressions.

How to do this?
Grafana version: 9.2.3 OSS

What is your data source?

Victoriametrics added as Prometheus data source.