I have an example to get difference between dates in days using datarange variable.
1st. How to split dates? - Simple, subquering any table (logs, access, etc.) with daterange variable in WHERE clause.
SELECT count(*) AS count,
(SELECT MIN("public"."database"."crm_date") FROM "public"."database" WHERE {{date_range}}) AS "start_date",
(SELECT MAX("public"."database"."crm_date") FROM "public"."database" WHERE {{date_range}}) AS "end_date",
...
FROM
...
2nd, Using DATE_PART function to operate with the subqueries results
SELECT
...
DATE_PART('day', (SELECT MAX("public"."database"."crm_Date") FROM "public"."database" WHERE {{date_range}})::timestamp - (SELECT MIN("public"."database"."crm_date") FROM "public"."database" WHERE {{date_range}})::timestamp)) AS "Days in range",
....
FROM ...
WHERE ..
GROUP BY ...
With this subquery tip you can access to individual "date.start" and "date.end" data from data range variable in Metabase SQL.