Filter by metric does not work

0

Hi!

I have an ad-hoc view with a simple table with Drivers and Number of services in a period of time.

The number of services is a metric calculated as the Sum of a field. In database the field is always 1.

The problem comes when filtering by that metric, because the SQL generated is filtering by the field and not by the sum of the field. So, if we put in the filter any value diferent from 1, the report displays no data.

This is the SQL

select `Nombre conductor`,sum(`Numero partes`) from wtoc
where `Fecha` between timestamp('2020-05-01 00:00:00') and timestamp('2020-05-31 00:00:00')
and `Numero partes` > 100
group by `Nombre conductor`

And I need something like this:

select `Nombre conductor`,sum(`Numero partes`) from wtoc
where `Fecha` between timestamp('2020-05-01 00:00:00') and timestamp('2020-05-31 00:00:00')
group by `Nombre conductor`
having sum(`Numero partes`) > 100

¿Could anybody help me?

 

Thanks!

 

Attachments: 
carolinapj's picture
Joined: Jul 19 2016 - 5:09am
Last seen: 4 weeks 22 hours ago

0 Answers:

No answers yet
Feedback
randomness