Trouble with Variables

Hi, I’m having trouble creating variables. I am connected to a Postgresql db on the cloud. In my metadata, gender is mapped as a Category.

A simple query that works:
SELECT count(*)
FROM investors
where gender = ‘m’

But when I do the following
SELECT count(*)
FROM investors
where gender = {{Mygender}}
creating a variable called Mygender with default value m, I get the following error:
ERROR: operator does not exist: gender = character varying Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 164

Please help as I am not able to create filters and variables in my dashboards even with this simple example.

OK now this works when variable cat is a text field but not when cat is a Field Filter, which I need it to be since user should select a value from the gender field and not enter any arbitary value. Any advice?

SELECT count(*) FROM investors WHERE TRUE [[AND gender = {{cat}}::gender]]