Nour Khaled
04/17/2025, 10:19 PMCeligo AI
04/17/2025, 10:19 PMAI generated answer (using internal Slack threads):Based on the conversations provided, it seems like you want to modify your formula to calculate from the beginning of the year to today's date, and include 'Invoice', 'Cash Sale', 'Credit Memo', and 'Cash Refund' transaction types. Here's how you can modify your formula:
sql
CASE
WHEN {type} IN ('Invoice', 'Cash Sale')
AND {trandate} BETWEEN TRUNC(SYSDATE, 'YEAR') AND SYSDATE
THEN {quantity}
WHEN {type} IN ('Credit Memo', 'Cash Refund')
AND {trandate} BETWEEN TRUNC(SYSDATE, 'YEAR') AND SYSDATE
THEN -{quantity}
ELSE NULL
END
In this formula, TRUNC(SYSDATE, 'YEAR')
will give you the date of the first day of the current year. The SYSDATE
will give you the current date. So, this formula will calculate the quantity from the beginning of the year to today's date for the specified transaction types.
******
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
04/17/2025, 10:19 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.867249906
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.858728468
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841843128
Celigo AI
04/17/2025, 10:19 PM