create filter to selected date

Hello please I created a filter to select a date and calculate the measures based on the date chosen.

my database is bigquery

here is my code, I want to compare ca_ht October 2020 vs ca_ht  October 2019 or April 2019 vs April 2018 etc ( month N : year N vs month N-1: year N-1)

filter: date_filter {
type: date
}

measure: CA_selected_month {
type: sum
sql: CASE
WHEN {% condition date_filter %} ${dte_vente_date} {% endcondition %}
THEN ${ca_ht}
END ;;
}

measure: CA_selected_month_ly {
type: sum
sql: CASE
WHEN {% condition date_filter %} DATE_ADD(DATE(${dte_vente_date}), INTERVAL 1 YEAR) {% endcondition %}
THEN ${ca_ht}
END ;;
}

and i have this error

The Google BigQuery Standard SQL database encountered an error while running this query.

Query execution failed: - No matching signature for operator >= for argument types: DATE, TIMESTAMP. Supported signature: ANY >= ANY at [4:18]

Solved Solved
0 1 729
1 ACCEPTED SOLUTION

`${ca_ht}` - is it a timestamp? That’s what the error suggests, that the right side of your condition is a timestamp.

You may need to convert `${dte_vente_date}` to timestamp first

View solution in original post

1 REPLY 1

`${ca_ht}` - is it a timestamp? That’s what the error suggests, that the right side of your condition is a timestamp.

You may need to convert `${dte_vente_date}` to timestamp first

Top Labels in this Space
Top Solution Authors