Optional Parameter

I’m trying to use optional parameter within a native query below, it was supposed to get a result even if filter is not selected but instead it show no result.
Another problem is that it show no result if two options is selected while it works with only one.

SELECT `avaliacao`.`answer` AS `Avaliação`, count(*) / (SELECT count(*) from avaliacao) AS Percentual
FROM `avaliacao`
LEFT JOIN `solicitacoes` ON `avaliacao`.`ID da Solicitação` = `solicitacoes`.`ID`
[[ WHERE `solicitacoes`.`Grupo` IN ({{grupo}}) ]]
GROUP BY `avaliacao`.`answer`
ORDER BY Percentual Desc

Metabase 0.31.1
Mysql 5.6.33

Hi @kelsen.faria

Upgrade to 0.31.2 - it fixes a couple of small things, like formatting.

It looks like you should be using Field Filter, which would mean that you link the filter to solicitacoes.Grupo and change your where query to:

[[ WHERE {{grupo}} ]]

Have a look at the documentation:

Hi @flamber

It looks like I missed the Field Filter part of the doc and jumped straight to optional parameter part.
Thank you