DATE_SUB function

Trying to write a Beast Mode that calculates yesterday's date. 

 

DATE_SUB(CURRENT_DATE(), interval 1 Days)

 

This formula validates just fine, but an error occurs when I try to use it in a table or see it in a drill down. 

 

Any ideas? 

Best Answer

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    You have a minor typo in your formula, it should be DAY not DAYS

     

    DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY)

     

    You can also shorten it since it defaults to DAY intervals:

     

    DATE_SUB(CURRENT_DATE, 1)​
    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**

Answers

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    You have a minor typo in your formula, it should be DAY not DAYS

     

    DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY)

     

    You can also shorten it since it defaults to DAY intervals:

     

    DATE_SUB(CURRENT_DATE, 1)​
    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**