title: How to make multiple conditions that may overlap in CASE statement and using GROUP BY
body: <p>I have a query in BigQuery:</p>
  
  <pre><code>WITH
    date_params AS(
    SELECT
      DATE_TRUNC(DATE_ADD(CURRENT_DATE(), INTERVAL -7 day), WEEK(MONDAY)) AS WeekStartDate,
      DATE_TRUNC(DATE_ADD(CURRENT_DATE(), INTERVAL -1 day), WEEK(SUNDAY)) AS WeekEndDate,
      date "2020-01-01" AS ReportStartDate,
      ),
    finances AS (
    SELECT
      Amount,
      CASE
        WHEN DATE (t1.Created ) BETWEEN WeekStartDate AND WeekEndDate THEN "Weelky"
        WHEN DATE (t1.Created ) BETWEEN ReportStartDate
      AND WeekEndDate THEN "Cumulative"
    END
      AS ReportPeriod
    FROM
      Table_1 t1,
      date_params p )
  SELECT
    SUM(Amount) AS `Amount`
  FROM
    finances
  GROUP BY
    ReportPeriod
  </code></pre>
  
  <p>Could you please explain how to group result Amount between two time periods: 1) last week and 2) from certain date (ReportStartDate) as I tried to do. The only problem appeared that CASE statement for "Cumulative" includes dates within "Weelky" but I need from the ReportStartDate till last Sunday including last week. </p>