CORRECT THIS FROMULA CASE WHEN {type} = 'Item Rece...
# ask-stanley-ai
n
CORRECT THIS FROMULA CASE WHEN {type} = 'Item Receipt' THEN {quantity}-{inventorydetail.quantity} AND {type} = 'Bill' THEN {quantity}+{inventorydetail.quantity} END
c
AI generated answer (using internal Slack threads):
The formula you provided seems to be missing an ELSE clause for the CASE WHEN statement. The corrected formula should look like this:
Copy code
sql
CASE 
    WHEN {type} = 'Item Receipt' THEN {quantity}-{inventorydetail.quantity} 
    WHEN {type} = 'Bill' THEN {quantity}+{inventorydetail.quantity} 
    ELSE {quantity} 
END
This formula will subtract the
inventorydetail.quantity
from
quantity
when the
type
is 'Item Receipt', add the
inventorydetail.quantity
to
quantity
when the
type
is 'Bill', and return the
quantity
as is for all other 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. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.859064579
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.853813589
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843662858
Please provide your feedback on this answer.