This question has already been asked, but instead a work around has been given.
This generates output
label_values(libvirt_domain_state_code{instance=~"$instance"} , domain)
This is a valid prometheus query that generates output
libvirt_domain_state_code{instance=~"xxx"} == 1
However this does not work
label_values(libvirt_domain_state_code{instance=~"$instance"}==1 , domain)
https://localhost:3000/t/how-to-filter-result-of-label-value/12069