Condition in filter

Hi, This is my full code.

SELECT COUNT(SHELBY_LEAD.ID) AS LEAD
FROM SHELBY_LEAD
INNER JOIN SHELBY_LEAD_DETAILS ON SHELBY_LEAD.ID = SHELBY_LEAD_DETAILS.ID
LEFT JOIN SHELBY_EVENT ON SHELBY_LEAD.ID = SHELBY_EVENT.LEAD_ID
LEFT JOIN SHELBY_SALERECORD ON SHELBY_LEAD.ID = SHELBY_SALERECORD.LEAD_ID
LEFT JOIN SHELBY_LEADSOURCE ON SHELBY_LEAD.SOURCE_ID = SHELBY_LEADSOURCE.ID
LEFT JOIN SHELBY_LEADSOURCECATEGORY ON SHELBY_LEADSOURCE.CATEGORY_ID = SHELBY_LEADSOURCECATEGORY.ID
LEFT JOIN SHELBY_DEALER ON SHELBY_LEAD.DEALER_ID = SHELBY_DEALER.ID
LEFT JOIN SHELBY_LEADSOURCECOMMONNAME ON SHELBY_LEADSOURCE.COMMON_NAME_ID = SHELBY_LEADSOURCECOMMONNAME.ID
WHERE 1=1
AND SHELBY_LEAD.CANONICAL_LEAD_ID IS NULL
AND SHELBY_LEAD.BAD_BY_ID IS NULL
AND SHELBY_LEAD.NA_BY_ID IS NULL
AND SHELBY_LEAD.STATUS NOT IN (80, 90)
AND {{Date}}

I want to make a condition. When {{Date}} IS NULL then last 7 days (SHELBY_LEAD.CREATED_AT).

Basically when user will not enter the date value, It will be last 7 days.

How I can make this?

check How do I create conditional queries using field filters in queries?