Template variable into aggregation query

Dear Grafana users,

I am trying to create a template variable for aggregation (max, mean,min and etc.) for my influxDB query. What I want is the user will just choose from the template variable on what aggregation type they want, and from that options, my trend panel will change based on the options selected by the user.
But when I am creating the query, it seems like it is not possible to populate the query from template variable in the aggregation? has anyone tried this before?

My template variable does not accept by the Trend Panel, I can configure this on the design mode, but again I want it to be dynamically.

Hoping for your kind reponse.

With kind regards,