Forum Discussion
Days Remaining Calculation
- Anonymous9 years ago
Awesome. Actually needed a MIN not MAX, as I was trying to get a day count between today and end date. If end date is after today then 0.
= MIN ( 1 * ( Today ( ) - YourTable[EndDate] ) , 0)
Thanks - this was extremely helpful!
- 9 years ago
Anonymous
If [End Date] > Today ( ) Then 0 Else 1 * ( Today ( ) - YourTable[EndDate] ) is equivalent to
MAX ( 1 * ( Today ( ) - YourTable[EndDate] ) , 0)
or
- MIN ( 1 * ( YourTable[EndDate] - Today ( ) ) , 0 )
But not to:
MIN ( 1 * ( Today ( ) - YourTable[EndDate] ) , 0)
OK Excel side. We're getting warmer, and this is awesome. However, using this solution when the end date is before today, it essentially begins couting days since the end date which ideally for my report would be 0.
i.e. if end date > today, then 0
Not sure how to incorporate that into your recommendation.
Thanks in advance.
Anonymous
Ok so you can use:
= MAX ( 1 * ( Today ( ) - YourTable[EndDate] ) , 0)
- Anonymous9 years agoNot applicable
Awesome. Actually needed a MIN not MAX, as I was trying to get a day count between today and end date. If end date is after today then 0.
= MIN ( 1 * ( Today ( ) - YourTable[EndDate] ) , 0)
Thanks - this was extremely helpful!
- Datatouille9 years agoSolution Sage
Anonymous
If [End Date] > Today ( ) Then 0 Else 1 * ( Today ( ) - YourTable[EndDate] ) is equivalent to
MAX ( 1 * ( Today ( ) - YourTable[EndDate] ) , 0)
or
- MIN ( 1 * ( YourTable[EndDate] - Today ( ) ) , 0 )
But not to:
MIN ( 1 * ( Today ( ) - YourTable[EndDate] ) , 0)
- Anonymous9 years agoNot applicable
This is the message when I try your latest recommendation. Appreciate all the help.
The syntax for '[End Date]' is incorrect. (DAX(If [End Date] > Today ( ) Then 0 Else 1 * ( Today ( ) - YourTable[EndDate] ) is equivalent to MAX ( 1 * ( Today ( ) - YourTable[EndDate] ) , 0))).
- Anonymous9 years agoNot applicable
Need some additional help...
Using the infomation you provided below, I am getting a strange output in my table. Not sure why the calculation is 6,748?
The DAX Statement is Days Remaining = max(1*('XXX Daily Power BI Dataset'[Order end date]-TODAY()),0)