Creating a dropdown menu for Date months only

Hi, i’m currently trying to make a dropdown menu specifically for months only

SELECT
avg(Monthly_Calls), district, “Crops”, “Months”, “Date”

FROM(
SELECT date_part(‘month’, t.created_on::date) as “Months”,
COUNT(*) AS Monthly_Calls,
t.created_on::date as “Date”,
district_name as district,
date_part(‘year’, t.created_on::date) as “Years”,
t.crop as “Crops”
FROM t
where true
[[and {{Crops}}]]
[[and date_part(‘month’, t.created_on::date) = {{Months}}]]
GROUP BY district_name, date_part(‘month’, t.created_on::date), date_part(‘year’, t.created_on::date), crop, created_on
)calls

where “Years” between 2012 and 2018
GROUP BY district, “Months”, “Crops”, “Date”, “Years”

i’ve only managed to take the Months in number value and i can return it and display it in the region map, but i wanted to make the months to become a drop down list just like the Crops menu consisting of value from 1-12 (Months are not available in database, database only have created_on which is a date , i.e 2018-09-12) I’m using PostgreSQL database inside the metabase

Any help would be nice thank you!

You’ll need to create a view and make the months a category.
As an aside, if you have a lot of data, that query will crawl with all those date_parts - full table scan and date conversions. Much more efficient to have a start and end date.

i’ve tried to create a view and it still not working, it shows ERROR: there is no parameter $1 Position: 629