Use date literals in business calculation

Hi, how can I refer to date literals in a business calculation ?
With this formula :

count(
  case(
    when: visits.visit_date >= '2023-03-10'
    , then: visits.visitor_id
  )
)

I get an error :

Expected `date` but found type `text` for `right_hand`

Note: I understand this looks like something that could be done with a condition on the chart itself but the idea here is to cut the line in multiple segments, each with a different color, by creating one measure for each segment. :sweat_smile:

Hi @dacou

Currently, we do not support casting functions in business calculations. However, we will include your case in our backlog and inform you of any updates regarding it.

As a workaround, you can create a custom dimension called visit_date_later_10_march with the following formula:

{{ #THIS.visit_date }} >= ‘2023-03-10’::date

Then, you create a business calculation as follows:

count(
  case(
    when: visit_date_later_10_march
    , then: visits.visitor_id
    , else: null
  )
)

This will count the number of visitors whose visit date is later than or equal to March 10, 2023. If you have any further questions or need additional support, please let me know.