cuddly-kilobyte-92191
12/07/2023, 3:13 PMWHERE 1=1
AND event_name = '{{ event_name }}'
And if I have these lines in my code, can I create filters like on the screenshot? Both the ones with "=" and "in" structure? Will it work or should I write it differently?
2) other filters
If I want to have metrics with different filters on the "platform", then I shouldn't write it in the "where" in fact table script at all? I just need to create appropriate filters for this fact table?rhythmic-agent-34208
12/07/2023, 3:13 PMbillions-xylophone-11752
12/07/2023, 3:58 PMfuture-teacher-7046
WHERE
clause of the fact table definition. For everything else, you should use filters.
So in your example, you should remove AND event_name = '{{ event_name }}'
from the WHERE clause. That way, your fact table will include all events. When you create a metric, you would add the appropriate filter to restrict it to the specific event. Same with platform, you should create filters instead of adding it directly to the WHERE clausefuture-teacher-7046
cuddly-kilobyte-92191
12/08/2023, 5:27 AMAND timestamp_micros(e.event_timestamp) BETWEEN '{{ startDate }}' AND '{{ endDate }}'
AND s.event_date BETWEEN date('{{ startDate }}') AND date('{{ endDate }}')
cuddly-kilobyte-92191
12/08/2023, 8:36 AMcuddly-kilobyte-92191
12/11/2023, 10:11 AMcuddly-kilobyte-92191
12/13/2023, 7:44 AMfuture-teacher-7046
{{ startDate }}
, and {{ endDate }}
placeholders are just meant for performance optimization when your data is partitioned by date. They can serve as hints to the query engine to limit the amount of data that needs to be scanned. Not really meant to actually affect the value of a metric.
Second, for the error it's likely an issue with the fact table SQL itself. I have a PR open to add more debugging for fact table filters that I hope to merge today that should provide more info. https://github.com/growthbook/growthbook/pull/1945cuddly-kilobyte-92191
12/14/2023, 7:26 AM