formula (currency) Case When to get the last year...
# ask-stanley-ai
n
formula (currency) Case When to get the last year month to date amount in a a saved search
c
AI generated answer (using internal Slack threads):
Based on the conversations, to get the last year month to date amount in a saved search, you can use a CASE WHEN statement in a formula (currency) field. The formula would look something like this:
Copy code
CASE WHEN TO_CHAR({trandate}, 'YYYY-MM') = TO_CHAR(ADD_MONTHS({today}, -12), 'YYYY-MM') THEN {amount} ELSE 0 END
This formula checks if the transaction date (
{trandate}
) is in the same month of the previous year as the current date (
{today}
). If it is, it returns the transaction amount (
{amount}
); otherwise, it returns 0. Please note that this formula assumes that
{amount}
is the field you want to sum up for the last year month to date. If you want to sum up a different field, replace
{amount}
with the appropriate field. ****** 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.849396884
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.845206261
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841825187
Please provide your feedback on this answer.