formula (currency) Case When to get the month to d...
# ask-stanley-ai
n
formula (currency) Case When to get the month to date amount in a a saved search
c
AI generated answer (using internal Slack threads):
To get the month to date amount 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 {trandate} BETWEEN TRUNC({today}, 'MONTH') AND {today} THEN {amount} ELSE 0 END
This formula checks if the transaction date (
{trandate}
) is between the first day of the current month and today. If it is, it returns the transaction amount (
{amount}
), otherwise it returns 0. Please note that this formula assumes that the
{amount}
field contains the transaction amount in the currency of the transaction. If you need to convert the transaction amount to a specific currency, you may need to use additional fields or functions. ****** 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.84717989
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840643764
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840239704
Please provide your feedback on this answer.