SQL query and question answers retrieving different data

Hello!

I first ran this question:

SELECT "source"."Core User - User__created" AS "Core User - User__created", "source"."is_entrepreneur" AS "is_entrepreneur", "source"."count" AS "count"
FROM (SELECT date_trunc('month', "Core User - User"."created") AS "Core User - User__created", "public"."core_profile"."is_entrepreneur" AS "is_entrepreneur", count(*) AS "count" FROM "public"."core_profile"
LEFT JOIN "public"."core_user" "Core User - User" ON "public"."core_profile"."user_id" = "Core User - User"."id"
WHERE ("public"."core_profile"."country_of_residence" = 'ET'
   AND ("Core User - User"."created" + (INTERVAL '0 month')) BETWEEN date_trunc('month', (now() + (INTERVAL '-12 month'))) AND date_trunc('month', now()))
GROUP BY date_trunc('month', "Core User - User"."created"), "public"."core_profile"."is_entrepreneur"
ORDER BY date_trunc('month', "Core User - User"."created") ASC, "public"."core_profile"."is_entrepreneur" ASC) "source" WHERE "source"."is_entrepreneur" = TRUE
LIMIT 1048575

But it retrieves inaccurate results. So I switched to this SQL query instead:

select cp.id, cu.created, cp.gender
from core_profile cp 
join core_user cu 
on cp.user_id = cu.id
where cp.country_of_residence = 'ET'
and cu.created < '2022-10-01'
and cu.created > '2021-09-30'
and cp.is_entrepreneur = TRUE

Which retrieves some of the results that I need but not in the right format with the variables I need (date, count per date and gender).

How can I either achieve the correct results in the Metabase question above or reword the SQL query to include the variables I need to visualize?

Hi @Sarah_McRae
Post "Diagnostic Info" from Admin > Troubleshooting, and which database type you're querying.
The GUI is using relative filters, while your SQL is using specific dates, and your SQL isn't grouping by anything. Try changing your GUI question to use specific dates.