Need help with beast modes to show yesterday's invoice total amount, and previous year, current date

I'm trying to create 2 beast modes to show yesterday's Total Invoice Amount and same day last year's Total Invoice Amount. For example, 10/27/2022, and 10/28/21

Yesterday: case when year(`INVOICE_DATE`) = year(CURDATE()) and MONTH(`INVOICE_DATE`) = MONTH(CURDATE()) then `INVOICE_TOTAL_AMOUNT` end --- This formula works

Same day last year: case when year(`INVOICE_DATE`)=YEAR(CURDATE()) -1 and YEAR(INVOICE_DATE) = MONTH(CURDATE()) then INVOICE_TOTAL_AMOUNT

Please help me. Thank you so much


Comments

  • GrantSmith
    GrantSmith Indiana 🥷

    Yesterday:

    CASE WHEN `INVOICE_DATE` = CURDATE() - INTERVAL 1 DAY THEN `INVOICE_TOTAL_AMOUNT` END
    

    Last Year:

    CASE WHEN `INVOICE_DATE` = CURDATE() - INTERVAL 1 YEAR THEN `INVOICE_TOTAL_AMOUNT` END
    
    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**