Multiple related variables within repeating text panels

I haven’t spent a ton of time in Grafana so there’s a chance I’m going about this completely wrong.

My initial concept is a card-based dashboard for quickly viewing call-center agent status. I setup three variables (1:id, 2:agent_id, 3:state) and was pleasantly surprised to learn about the Repeat options on panels. Using test data, I was able to repeat the text panel based on the id field. The issue is when I try to include the agent_id and state fields in the same card. As you can see from the screenshot, it clearly does not recognize any relationship b/t the variables. Each card displays all possible agent_ids and states.

My attempt to modify the agent_id variable’s query was unsuccessful.

Current variable query:

SELECT agent_id from presence_change

Attempted(failed) fix:

SELECT agent_id from presence_change WHERE id = $presence_table_id

Screenshot of dashboard: