Built-in Functions → weekDay

weekDay() is a conversion function that returns the count of days from the beginning of the week for the current date, where a week starts on Sunday (day 1) and ends on Saturday (day 7).

Signature

weekDay()

Returns

int representing the week’s day number for the current date.

Example

Identify the day number of the week, for the current date, 08/26/2021.

weekDay()

The following table illustrates the behavior of the weekDay() conversion function:

ProductRevenuesweekDay()
CD$2005
Hard disk$6005
Cable$5505
Hardware$8005
Memory Card$2205

The current date is Thursday, August 26th, and the week starts on Sunday. Thus, the count of the weekDay() is 5.


Use the following steps for detailed instructions on how to use the weekDay() conversion function to tackle the above example in an insight:

Note

In the Cluster Management Console (CMC), create a tenant that includes Sample Data. The Sample Data includes the SALES schema.

  • 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 Insight panel, select Listing Table or V.
  • In Tables, select Aggregated Table.
  • In the Data panel, select Manage Dataset.
  • In the Manage Data Sets panel, in Tables, select SALES. Close the panel.
  • From the Data panel, drag and drop the following columns to the respective tray:
    • Category from the PRODUCTS table to the Grouping Dimension tray.
    • Revenue from the SALES table to the Measure tray.
      • In the Properties panel, for Number Format, select Dollar Rounded.
  • From the Data panel, drag and drop Add Formula to the Grouping Dimension tray.
  • The Formula Builder automatically opens:
    • In Search Functions, select the down arrow, and then select Conversion Functions.
    • Double-click the weekDay function, weekDay(), to add the formula to the editor.
    • Select Validate & Save.
  • In the Properties panel, for Column Label, enter weekDay().
  • Name the insight Revenue Per Category.
  • In the Action bar, select Save.