WEEKOF(A,B)
- 1 Minute to read
- Print
- DarkLight
- PDF
WEEKOF(A,B)
- 1 Minute to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Date Transform: WEEKOF(A,B)
Groups Date B into weekly segments, where first week begins on Date A
Purpose
Use this function to:
- Group observations into weekly segments, starting on a fixed date
- Segment data for use in a time-series report, where the reporting interval is in weeks
- Calculate "Week Commencing" for a date field (W/C)
Return Value
Property | Value |
---|---|
FieldType | Date |
FieldSize | |
DataType | Discrete |
DataSize | Short |
Example Return Value: 2019-01-01, 2019-01-08...
Where values are always 7 days apart
Parameters
Parameter | JSON | Description |
---|---|---|
Table | “targetTable”: “MyTableName” | The target table on which the new field will be created |
Filter | “dataset”: {DataSet_JSON} | Optional. If a filter is applied, records not in the filter Recordset will be returned as null. |
DateTimeFunction | “p1”: “WEEKOF(A,B)” | WEEKOF(A,B) |
A | “p2”: “DateTimeFieldName” “p2”: “DateFieldName” “p2”: “#YYYY-MM-DD HH:MM:SS” “p2”: “#YYYY-MM-DD” | Required. The date which provides the first value in the week commencing series Supports:
For example: If A is 2019-01-01, and B is 2019-01-06, WEEKOF(A,B) will be 2019-01-01 If A is 2019-01-01, and B is 2019-01-09, WEEKOF(A,B) will be 2019-01-08 If A is 2019-02-08, and B is 2019-02-06, WEEKOF(A,B) will be 2019-02-01 If A is 2019-02-09, and B is 2019-02-06, WEEKOF(A,B) will be 2019-02-02 |
B | “p3”: “DateTimeFieldName” “p3”: “DateFieldName” “p3”: “#YYYY-MM-DD HH:MM:SS” “p3”: “#YYYY-MM-DD” | Required. The date to sort into Weekly segments Supports:
|
JSON Sample
Usage Notes
Use this function to calculate the date of the beginning of the week for an event or observation. To specify the day on which the week commences, make sure that parameter A falls on the desired weekday.
See Also:
- WEEKDAY(A) - Week day as integer
- SWEEKDAY(A) - Weekday as string
- WOY(A) - Week of year
Example
Example | Details |
---|---|
Description | Group into weeks, where first week begins on #201-01-01 |
Input |
|
Sample |
Was this article helpful?