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

anh_tr_huynh4
anh_tr_huynh4 Member
edited April 2023 in Beast Mode

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


Best Answer

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    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!**

Answers

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    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!**