formula (currency) Case When to get the last year ...
# ask-stanley-ai
n
formula (currency) Case When to get the last year YTD amount in a a saved search
c
AI generated answer (using internal Slack threads):
To get the last year YTD amount in a saved search, you can use a formula (currency) case when in the results tab of your saved search. Here is an example of how you can do it: 1. Navigate to Reports > Saved Searches > All Saved Searches > New. 2. Choose the record type for your search. 3. Enter a name for your search in the Search Title field. 4. Under the Criteria tab > Standard sub tab, set your desired filters. 5. Under the Results tab > Columns sub tab > Field column, click to display a dropdown and: - Select Formula (Currency) with Summary Type = Sum and Custom Label = Summary Label = Sales Last Year. - Enter the following formula:
Copy code
CASE WHEN TO_CHAR({transaction.trandate},'YYYY')=TO_CHAR({today},'YYYY')-1 THEN {transaction.amount} ELSE 0 END
This formula checks if the transaction date's year is equal to the current year minus one (last year). If true, it returns the transaction amount; otherwise, it returns 0. Remember to replace
{transaction.trandate}
and
{transaction.amount}
with your actual fields 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.840108633
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834819436
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833903611
Please provide your feedback on this answer.