Nour Khaled
04/20/2025, 11:51 AMCeligo AI
04/20/2025, 11:51 AMAI generated answer (using internal Slack threads):Based on the conversations, it seems like you are trying to create a formula that calculates the sum of quantities for specific transaction types within a certain date range. Here is a simplified version of your formula:
sql
CASE
WHEN {type} IN ('Invoice', 'Cash Sale') AND {trandate} BETWEEN ADD_MONTHS(SYSDATE, -12) AND SYSDATE THEN {quantity}
WHEN {type} IN ('Credit Memo', 'Cash Refund') AND {trandate} BETWEEN ADD_MONTHS(SYSDATE, -12) AND SYSDATE THEN -{quantity}
ELSE NULL
END
This formula checks the transaction type and date. If the transaction type is 'Invoice' or 'Cash Sale' and the transaction date is within the last 12 months, it sums the quantity. If the transaction type is 'Credit Memo' or 'Cash Refund' and the transaction date is within the last 12 months, it subtracts the quantity. For all other cases, it returns NULL.
Remember to use this formula in the Results tab of your saved search, and set the Summary Type to 'Sum' to get the total quantity.
******
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/20/2025, 11:52 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.873247147
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855123341
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846234083
Celigo AI
04/20/2025, 11:52 AM