Nada Ahmed
08/25/2024, 2:25 PMCeligo AI
08/25/2024, 2:25 PMAI generated answer (using internal Slack threads):To get the same month last year 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:
sql
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 today's 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. If you want to sum up a different field, replace {amount}
with the appropriate field.
Also, this formula will return the amount for the same month last year up to the current day of the month. If you want to get the total amount for the entire month of the previous year, you would need to adjust the formula accordingly.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
08/25/2024, 2:25 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.859096348
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854474187
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849578619
Celigo AI
08/25/2024, 2:25 PM