formula (currency) Case When to get the last year ...
# ask-stanley-ai
n
formula (currency) Case When to get the last year for example (1/1/2023) till the same date last year ( 8/25/2023) amount in a saved search
c
AI generated answer (using internal Slack threads):
Based on the conversations, to get the amount for the last year till the same date last year in a saved search, you can use a formula (currency) with a CASE WHEN statement. The formula would look something like this:
Copy code
sql
CASE 
    WHEN {transaction.trandate} BETWEEN ADD_MONTHS({today}, -12) AND {today} 
    THEN {amount} 
    ELSE 0 
END
This formula checks if the transaction date is between the current date last year and the current date. If it is, it returns the transaction amount; otherwise, it returns 0. Please note that
{today}
is a NetSuite placeholder that represents the current date, and
{amount}
represents the transaction amount. You would replace these with your actual field identifiers if they are different. ****** 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.846087575
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.845998764
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843133509
Please provide your feedback on this answer.