Forum Discussion
Remaining days calculation based on a date column
Example formula below.
Due Date =
- Anonymous2 years ago
Hi MikeHunt
Ahmedx Thank you very much for your prompt reply!
When I was checking the posts in our community, I found your post. May I ask if your issue has been resolved? If not, here I have provided an alternative code logic, please refer to the following method:
Here's some dummy data
“Table”
Create a measure.
MEASURE = VAR _Diff = DATEDIFF(SELECTEDVALUE('Table'[NextRevision]), TODAY(), DAY) RETURN SWITCH( TRUE, _Diff <= 0, "Overdue", 0 < _Diff && _Diff <= 30, "Less than 30 days", 30 < _Diff && _Diff <= 60, "Less than 60 days", 60 < _Diff && _Diff <= 90, "Less than 90 days", "In Compliance" )Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- Ahmedx
Super User
pls try this code
Due Date = VAR _Diff = DATEDIFF( TODAY(),tbl_Materials[NextRevision] ,DAY) RETURN SWITCH(TRUE, _Diff <= 0 "Overdue", _Diff <= 30, "Less than 30 days", _Diff <= 60, "Less than 60 days", _Diff <= 90, "Less than 90 days", "In Compliance" ) ===== or === MEASURE = VAR _Diff = DATEDIFF(TODAY(),MAX(tbl_Materials[NextRevision] ) ,DAY) RETURN SWITCH(TRUE, _Diff <= 0 "Overdue", _Diff <= 30, "Less than 30 days", _Diff <= 60, "Less than 60 days", _Diff <= 90, "Less than 90 days", "In Compliance" ) - Ahmedx
Super User
I checked the measure again - AnonymousNot applicable
Hi MikeHunt
Ahmedx Thank you very much for your prompt reply!
When I was checking the posts in our community, I found your post. May I ask if your issue has been resolved? If not, here I have provided an alternative code logic, please refer to the following method:
Here's some dummy data
“Table”
Create a measure.
MEASURE = VAR _Diff = DATEDIFF(SELECTEDVALUE('Table'[NextRevision]), TODAY(), DAY) RETURN SWITCH( TRUE, _Diff <= 0, "Overdue", 0 < _Diff && _Diff <= 30, "Less than 30 days", 30 < _Diff && _Diff <= 60, "Less than 60 days", 60 < _Diff && _Diff <= 90, "Less than 90 days", "In Compliance" )Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.