Let’s say you’d like to have a custom SQL table in your Workbook filter out dates in a DATE column according to any of the many possible selections in the date range parameter (pictured below):
This can be accomplished using some iteration of the following CASE/WHEN statement in custom SQL:
SELECT * FROM table
WHERE
CASE WHEN date({{Date-Parameter}}:start) IS NULL
THEN DATE <= date({{Date-Parameter}}:end)
WHEN date({{New-Control}}:end) IS NULL
THEN DATE >= date({{Date-Parameter}}:start)
ELSE DATE BETWEEN date({{Date-Parameter}}:start) AND date({{Date-Parameter}}:end)
END