Filter based on column then aggregate and then filter again


I am trying to count number of min(A) group by B where C is qual to a certain value before filtering based on date. I dont seem to be able to get this working. Please help me with this matter. For instance in SQL I would write the statement like that:

(SELECT EventDateTime, min(id) as firstId
from A
where second_id = 6 group by third_id) AS a
where EventDateTime between ‘2022/05/02 00:00:00’ and ‘2022/05/02 23:59:59’;

Basically what I want is to be able to filter using parameter and then group by during analysis then filter based on date inside visualisation stage

Hi @RyanJ

It’s possible this might require customSQL and possibly a feature currently in development that allows us to pass parameters to custom SQL.

To fully understand, can you talk to me about the data looks like? Also a bit confused in your sql as you have eventadate in the select statement but then grouping by third_id. Assuming you meant to also group by and select on both datetime & third_id?

Is this direct query or spice?

Ramon Lopez