Vedachalam Mahadevan
03/17/2025, 12:21 PMCeligo AI
03/17/2025, 12:21 PMAI generated answer (using internal Slack threads):To get the Sunday of the next week given a date, you can use the
NEXT_DAY
function in combination with the DATEADD
function. The NEXT_DAY
function returns the first weekday that is greater than a date. The weekday is specified as a string (e.g., 'SUNDAY'). The DATEADD
function adds a specified time interval to a date.
Here is a sample formula that you can use:
sql
CASE
WHEN {duedate} <= NEXT_DAY({today},'SUNDAY')
THEN DATEADD('day', 7, NEXT_DAY({today},'SUNDAY'))
ELSE {duedate}
END
In this formula, if the duedate
is less than or equal to the next Sunday from today, it adds 7 days to the next Sunday from today, effectively giving you the Sunday of the next week. If the duedate
is not less than or equal to the next Sunday from today, it simply returns the duedate
.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
03/17/2025, 12:21 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.823921919
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822015166
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.794435084
Celigo AI
03/17/2025, 12:21 PM