Date minus a few weeks

Hello guys, 

 

Am looking for code which states:

Return X (actuals) between (current date minus 3 weeks) and (current date minus 2 weeks).

The code I am currently writing is not returning the correct values for the correct dates.

 

Could someone help me out please?

 

Many thanks to the community,

 

Best Answer

  • Valiant
    Valiant Coach
    Answer ✓

    Here's the basics on how I would write this as a beast mode:

    CASE WHEN `Date` >= DATE_SUB(CURRENT_DATE(), INTERVAL 3 WEEK) AND `Date` <= DATE_SUB(CURRENT_DATE(), INTERVAL 2 WEEK)
    THEN `Actuals`
    END

    Hope that helps,

    Valiant

     

    **Please mark "Accept as Solution" if this post solves your problem
    **Say "Thanks" by clicking the "heart" in the post that helped you.

Answers

  • Valiant
    Valiant Coach
    Answer ✓

    Here's the basics on how I would write this as a beast mode:

    CASE WHEN `Date` >= DATE_SUB(CURRENT_DATE(), INTERVAL 3 WEEK) AND `Date` <= DATE_SUB(CURRENT_DATE(), INTERVAL 2 WEEK)
    THEN `Actuals`
    END

    Hope that helps,

    Valiant

     

    **Please mark "Accept as Solution" if this post solves your problem
    **Say "Thanks" by clicking the "heart" in the post that helped you.