Interpolate String in Query with Ternary

I have a situation where I am trying to use the same variable for two different graphs using two different querying languages (KQL and PromQL). The problem I am facing is that an “All” tag value needs to be written differently for the two languages (afaict).

I looked everywhere to see if there’s a functionality like this, but i figured I’d ask here too… is something like this possible?

application:"$application" AND datacenter: {$datacenter === “all” ? “*” : $datacenter}

sum(kube_pod_container_info{cluster_name=~"cn-{$datacenter === “all” ? “.*” : $datacenter}",namespace="$application"})