select d.name, EXTRACT(hour FROM sum(enddatetime - startdatetime)) as sumTime
from events e
inner join eventsdashboard le on le.eventtypeid = e.eventtypeid
inner join driver d on d.driverid = e.driverid
where eventcategory = '"Detail"'
and d.employeenumber is not null
and {{evento}} --THATS MY PROBLEM
[[ and cast(e.startdatetime as date) between {{datainicio}} and {{datafim}} ]]
group by d.name
having EXTRACT(hour FROM sum(enddatetime - startdatetime)) > 0
order by 2 desc
If the field you're working with is a category-type field, you should be able to configure the variable type as a "Field Filter". I've included a few screenshots below of a configuration that works with the Sample Data. What error are you getting with the query where you have and {{evento}}? Can you include a screenshot of the variable config page as well?
My query:
SELECT * FROM products
WHERE rating < 5 AND {{ean}}
But I think the problem it is the join that I made with tables. And I've got error only when I choose a option in the filter, when I dont choose anything it is work fine