Point to one or another table based on date filter

Hi!

I have two tables on BQ, one table has the historical information (< 2022) and the other has actual information (>= 2022).

I’m trying to create a Liquid sentence on the sql_table_name parameter inside the view, so the query use one table or another, based on the date filtered.

This is the sentence I made that doesn’t work:

sql_table_name: `project.dataset.{% if lkp_dates.date._is_filtered and lkp_dates.date < "2022-01-01 00:00:00" %}fct_historical_data{% else %}fct_actual_data{% endif %}` ;;

I notice that the sentence works when I use only the _is_filtered parameter, but I can’t make it work when I want to apply the date.

Do you have any idea on how to make it work?

Thanks!

2 1 251
1 REPLY 1
Top Labels in this Space
Top Solution Authors