Forum Discussion
Coding for 3 month
- 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 2023 ALERT Wednesday, 1 February 2023 ALERT Wednesday, 1 March 2023 ALERT Saturday, 1 April 2023 NO ALERT Monday, 1 May 2023 NO ALERT
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 2023 | ALERT |
| Wednesday, 1 February 2023 | ALERT |
| Wednesday, 1 March 2023 | ALERT |
| Saturday, 1 April 2023 | NO ALERT |
| Monday, 1 May 2023 | NO ALERT |
- Anonymous3 years agoNot applicable
Hi Barthel
Thank you so much for getting back to me!
This is almost what I need it seems, but I don't need the today's dateThe ReviewDate column has the dates against which i'd like to go
Could you please advise on how to make it so if its 3 months before the date in ReviewDate column ALERT, otherwise NO ALERT
the
- Barthel3 years agoSolution Sage
Anonymous
What would you want to compare with the review date? 3 months relative to what? Now the calculated column defines review dates which are within the next 3 months from today as 'ALERT'.
- Anonymous3 years agoNot applicable
Yes you are absolutely right
Apologies I have had a very long day
Thank you once again and apologies once again