Forum Discussion
Difference between date culumns with an IF like statement
- 10 years ago
Again..thank you very much for your help solving this.
I finally approached it a little bit differently, by eliminating the data rows from the logic where the "start date" was greater than the "end date". I simply added another IF statement to put a 0 in that row if that condition is true.
Here is the new formula, hopefully it will help other people with the same issue:
NewColumn = IF('Table'[StartDate] <= IF(ISBLANK('Table'[EndDate]),TODAY(),'Table'[EndDate]) , DATEDIFF('Table'[StartDate], if(ISBLANK('Table'[EndDate]),TODAY(),'Table'[EndDate]),DAY), 0)
khalidmadih ok. Do this instead,
NewColumn = (YOURTABLE[end] - YOURTABLE[start]) * 1.
This will work regardless of dates are gretaer or lower in either columns and will give you number accordingly either in positive or negative.
Again..thank you very much for your help solving this.
I finally approached it a little bit differently, by eliminating the data rows from the logic where the "start date" was greater than the "end date". I simply added another IF statement to put a 0 in that row if that condition is true.
Here is the new formula, hopefully it will help other people with the same issue:
NewColumn = IF('Table'[StartDate] <= IF(ISBLANK('Table'[EndDate]),TODAY(),'Table'[EndDate]) , DATEDIFF('Table'[StartDate], if(ISBLANK('Table'[EndDate]),TODAY(),'Table'[EndDate]),DAY), 0)