Hi Ann,
Can you try creating a variable as detail.
Keep the definition of this detail variable as [query2.ObjectName].
Associate this detail variable to the merged dimension.
Now use this detail in the if logic suggested by Durga.
Let us know, if this works.
Thanks
Gaurav