I am trying to use Templated Filters logic in LookML to filter a look/dashboard based on flexible dates i.e., whatever date value the user enters in the date filter (transaction_date_filter dimension in this case). Below is my LookML,
view: orders {
derived_table: {
sql:
select
customer_id,
price,
haspaid,
debit,
credit,
transactiondate,
case when haspaid= true or cast(transactiondate as timestamp) >= date_trunc(cast({% condition transaction_date_filter %} cast(transactiondate as timestamp) {% endcondition %} as timestamp),year) then debit- credit else 0 end as ytdamount
FROM
orders ;;
}
dimension: transaction_date_filter {
type: date
sql: cast(${TABLE}.transactiondate as timestamp) ;;
}
}
I get the below error,
Invalid cast from BOOL to TIMESTAMP
Can someone please help?