How to Filter Clients in a Dropdown Based on User in Metabase

Hi everyone,

I’m working on a query in Metabase, and I’m trying to show a list of clients in a dropdown that are specific to a particular user (idusuario). The issue I’m facing is that the dropdown for clients ({{reporte_disponibilidad_3.cliente}}) displays all clients, but I need it to only show clients associated with the logged-in user.

My questions:
How can I limit the client dropdown to only show clients linked to the current user (idusuario)?
What’s the best way to link a secondary query that returns the list of clients to this Field Filter in the main query?

Here’s the query I’m working with:

SELECT 
  'Activos' AS estado,
  ROUND(SUM(reporte_disponibilidad_3.activo) / 
		(SUM(reporte_disponibilidad_3.activo) + SUM(reporte_disponibilidad_3.inactivo)) * 100, 2) AS "Porcentaje"
FROM 
  reporte_disponibilidad_3
JOIN
  usuario_cliente_final ON reporte_disponibilidad_3.idcliente = usuario_cliente_final.iddestino
JOIN
  usuario ON usuario_cliente_final.idusuario = usuario.idusuario
JOIN
  perfil_tiporeporte ON usuario.fkidperfil = perfil_tiporeporte.fkidperfil
  AND perfil_tiporeporte.fkidtiporeporte = reporte_disponibilidad_3.idtiporeporte  -- Link with report type
WHERE
  usuario.idusuario = {{idusuario}}  -- Filter by the current user
  AND {{reporte_disponibilidad_3.fecha}}  -- Date filter
  AND {{reporte_disponibilidad_3.cliente}}  -- Client filter

UNION ALL

SELECT 
  'Inactivos' AS estado,
  ROUND(SUM(reporte_disponibilidad_3.inactivo) / 
		(SUM(reporte_disponibilidad_3.activo) + SUM(reporte_disponibilidad_3.inactivo)) * 100, 2) AS "Porcentaje"
FROM 
  reporte_disponibilidad_3
JOIN
  usuario_cliente_final ON reporte_disponibilidad_3.idcliente = usuario_cliente_final.iddestino
JOIN
  usuario ON usuario_cliente_final.idusuario = usuario.idusuario
JOIN
  perfil_tiporeporte ON usuario.fkidperfil = perfil_tiporeporte.fkidperfil
  AND perfil_tiporeporte.fkidtiporeporte = reporte_disponibilidad_3.idtiporeporte  -- Link with report type
WHERE
  usuario.idusuario = {{idusuario}}  -- Filter by the current user
  AND {{reporte_disponibilidad_3.fecha}}  -- Date filter
  AND {{reporte_disponibilidad_3.cliente}}  -- Client filter
In this query:

I tried creating a separate query to return the idcliente and nombre_destino from the usuario_cliente_final table, but I’m unsure how to apply this in the main query so that the Field Filter for clients only shows the relevant options.

Thanks in advance for any advice!