2

I am trying to see if there is a way to have the filter on a date parameter be a date range instead of a single date value. Does anyone have any creative ideas on how to do this.

Chadc
  • 53
  • 4

1 Answers1

0

You probably want to replace your parameter with a templated filter. See the docs for more info, but in short:

In situations where you want to offer users more flexible input (such as with various kinds of date ranges or string searches), try to use templated filters when possible.

Your code will look something like this:

view: customer_facts {
  derived_table: {
    sql:
      SELECT
        customer_id,
        SUM(sale_price) AS lifetime_spend
      FROM
        order
      WHERE
        {% condition order_date %} order.dt {% endcondition %}
      GROUP BY 1
    ;;
  }

  dimension: order_date {
    type: date
    sql: ${TABLE}.dt ;;
}
tconbeer
  • 4,570
  • 1
  • 9
  • 21