A saved search SQL formula to check if {period} is...
# ask-stanley-ai
a
A saved search SQL formula to check if {period} is within this fiscal year?
c
AI generated answer (using internal Slack threads):
Based on the conversations, to check if a period is within this fiscal year in a saved search SQL formula, you can use a CASE statement in your formula. Here is an example:
Copy code
sql
CASE 
    WHEN TO_CHAR({trandate}, 'YY') = TO_CHAR({today}, 'YY') THEN {amount} 
    ELSE 0 
END
This formula checks if the year of the transaction date (
{trandate}
) is the same as the current year (
{today}
). If it is, it returns the amount of the transaction. If not, it returns 0. Please note that this formula assumes that your fiscal year aligns with the calendar year. If your fiscal year starts in a different month, you may 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. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.852095306
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846153736
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841618478
Please provide your feedback on this answer.