Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Coding for 3 month

Hi All   I was wondering if you can help with below    I need to write have a conditional column for 3 month prior to review date   So, I have "review dates" column, and  need something along t...
  • Barthel's avatar
    3 years ago

    Hey Anonymous,

    You could add an 'Alert' calculated column to your table:

     

     

    Alert = 
    IF ( DATEDIFF ( TODAY (), 'Table'[Reviewdate], MONTH ) <= 3, "ALERT", "NO ALERT" )

     

     

    DATEDIFF calculates the difference between two dates, in this case in months. TODAY returns today as a date. This is updated every time the report is refreshed, making the code dynamic.

    Result:

    ReviewdateAlert

    Sunday, 1 January 2023ALERT
    Wednesday, 1 February 2023ALERT
    Wednesday, 1 March 2023ALERT
    Saturday, 1 April 2023NO ALERT
    Monday, 1 May 2023NO ALERT