Week Ending Vs. Week Beginning

Looker will not be updating this content, nor guarantees that everything is up-to-date. 

Looker starts the week on Monday. For example, if today is Thursday, April 11, 2019, today belongs to the week 04/08/2019. If it is Saturday, April 20, 2019, today belongs in the week 04/15/2019.
 

50ca3865-7ecc-4f6b-afae-758f8b37518f.png

However, some reports must display week-ending dates rather than week-beginning dates. How do you get Looker to display the ending dates for weeks? You can convert the dates to an end date on Sundays.

Example

  1. We start with the created dimension group.
  2. In the next dimension, we add 7 days to end the week on Sunday. This is how it looks in LookML:
    dimension_group: created {
    type: time
      timeframes: [time, hour_of_day, date, week, month, year]
      sql: ${TABLE}.created ;;
    }

    dimension: created_week_ending_sunday {
      type: date
      sql: DATEADD( day, 7, ${created_date});;
      datatype: date
    }
The example above uses the DATEADD function from Redshift. The DATEADD function may differ on other SQL dialects.


You can use this method to end days on whichever day of the week you like. If you want to modify the day of the week that your weeks begin, you can use the week_start_day LookML parameter, as described on the week_start_day parameter documentation page.

Version history
Last update:
‎05-11-2022 11:43 AM
Updated by: