Filter/Limit "until" date in a Dashboard

So I've a Model from a Native Query, I turned it in a question and visualise in a dashboard.

The result of my question is aggregated and has a "purchased_date" DATETIME and there is a cumulated sum and ordered by this date.

I'd like to add an "Until date" filter to be able to see the cumulative sum until a given date.

If I select range my result is "sliced" to the period which is not correct in my case because the limit is applied by the cumulative sum.

If I select a single date, then it filters the purchased_date.

How can I achieve "filter/limit until" ?

Hey there, I have encountered this situation several time. My suggestion would be to build a query from scratch applying a CTE, something like:

WITH
 your_subquery AS(
    SELECT
     *
    FROM table_x_coming_from_your_model
    WHERE {{ until_ purchased_date }} -- here your metabase filter
  )
SELECT
  -- here your cumulative logic
FROM your_subquery

Hope this helps!