Variable not working due to not matching data type

Hi all,

I am quite new to Metabase and I am right now trying to make variables working on some of my questions, below is example of my select, where I want to use variable obviously I will use variable options to match it to respective collumn. However following error appears all the time. What am I doing wrong?

ERROR: operator does not exist: character varying = boolean Hint: No operator matches the given name and
argument type(s). You might need to add explicit type casts. Position: 1284

SELECT “a”.“department”,
“a”.“email”,
“b”.“media_type”,
“c”.“name” AS “queue_name”,
count(“b”.conversation_id") AS “count”

	FROM "b"

LEFT JOIN “a” ON “b.user_id” = “a”.“user_id”

LEFT JOIN “c” ON “b”.“queue_id” = c.“queue_id”

WHERE

(    "b" = 'alert'
AND ("b"."media_type" = 'chat'OR "b"."media_type" = 'email') 
AND "b" = 'inbound' 
AND "b"."disconnect_type" = 'system' 
AND date_trunc('year', CAST("b"."segment_start" AS timestamp)) = date_trunc('year', CAST(now() AS timestamp))

    **AND   CAST("public"."purecloud_full_conversations"."media_type" as varchar) = {{media_type}}))**

GROUP BY 
	"b"."user_id", 
	"b"."media_type", 
	"b"."queue_id", 
CAST("b" AS date), 
	"a"."email",
	"c"."name",
	"a"."department"