Built-in Functions → weekStartDate

weekStartDate() is a scalar date function that returns the date of the first day of the current week.


A week starts on Sunday and ends on Saturday.




Date representing the first date of the current week.


Consider the following table as a sample data:

Date Quarter Month Sales Amount
5/22/2021 Q2 M5 100
5/21/2021 Q2 M5 200
5/23/2021 Q2 M5 100
4/22/2021 Q2 M4 150
5/20/2021 Q2 M5 250
6/22/2021 Q2 M6 150
3/22/2021 Q1 M3 200
5/10/2021 Q2 M5 250
5/01/2021 Q2 M5 300
5/09/2021 Q2 M5 100
5/30/2021 Q2 M5 50
2/22/2021 Q1 M2 50

Consider a case where you want to identify the start of the current week and the sales amount that occurred after that date, for example, the current week is 5/22/2021.

  • Start date of the current week
  • Sales after the week start date

    SALES_ACME.SALES.TIME_ID >= weekStartDate()

This example returns all Sales amount that occurred after the start of the current week.

QuarterDateSales Amount

Use the following steps for detailed instructions on how to use the weekStartDate() date function:


The sample data is uploaded, and then added and loaded into a Schema named SALES_Acme. For more information on creating a data source and a schema, refer to the Guides→Start document.

  • In the Navigation bar, select the Content tab, and then select + New → Add Dashboard.
  • In the Add Dashboard dialog, for Name, enter Product Dashboard, and then select Add.
  • In the Action bar, select + (add icon), or select + Add Insight.
  • In the Data panel, select Add Data Set (+).
  • In the Manage Data Sets panel, in Tables, select SALES_Acme. Close the panel.
  • From the Data panel, drag and drop the following columns to the respective tray:
    • From the SALES table, drag and drop Quarter to the Grouping Dimension tray.
    • From the SALES table, drag and drop Sales Amount and Date to the Measure tray.
    • In the Properties panel for Sales Amount:
      • For Format, select Dollar Rounded.
  • From the Data panel, drag and drop Add Formula to the Individual Filter tray.
  • The Formula Builder automatically opens:
    • In Search Functions, select the down arrow, and then select Date Functions.
    • Double-click the weekStartDate function, weekStartDate(), to add the formula to the editor.
    • In the Formula Editor, use the following condition:
      • SALES_ACME.SALES.TIME_ID >= weekStartDate()
    • Select Validate & Save.
  • In the Measure tray, double-click the New Formula pill and rename it to weekStartDate().
  • Name the insight Sales per Quarter After Current Week Start Date.
  • In the Action bar, select Save.