Forum Discussion
Delguy87
2 years agoFrequent Visitor
Need Help fixing datediff. Seeing 'same day' and 'BLANK' data(for one of the day) as same results.
I'm creating a report for Trouble Tickets. I have 2 columns representing 'Date Created' and 'Date Completed'. The resulting Column('# of Days to Clear 2') from _datediff generates my results but I'm ...
- 2 years ago
Delguy87 Instead of DATEDIFF, use:
( [Date Completed] - [Date Created] ) * 1.Then check for >= 0 && <= 7Those without a Date Completed will be negative - 2 years ago
Thanks for the reply. you helped me to a solution. this was what ended up working for me. For some reason, i was getting an error for ' >= 0 && <= 7'
# of Days to Clear 2 = var _diff = ([Date Completed]-[Date Created]*1)returnSwitch(True() ,_diff <=-1, "Remaining Open",_diff <=7, "Cleared in 7 days or less",_diff <=30 , " Cleared in 8 to 30 days",_diff <=60 , " Cleared in 31 to 60 days",_diff <=90, " Cleared in 61 to 90 days",_diff <=120, " Cleared in 91 to 120 days",_diff >120, "Cleared in 120 days or more"--_diff =blank(), "remaining open")
Greg_Deckler
2 years agoCommunity Champion
Delguy87 Instead of DATEDIFF, use:
( [Date Completed] - [Date Created] ) * 1.
Then check for >= 0 && <= 7
Those without a Date Completed will be negative
Delguy87
2 years agoFrequent Visitor
Thanks for the reply. you helped me to a solution. this was what ended up working for me. For some reason, i was getting an error for ' >= 0 && <= 7'
# of Days to Clear 2 = var _diff = ([Date Completed]-[Date Created]*1)
return
Switch(True() ,
_diff <=-1, "Remaining Open",
_diff <=7, "Cleared in 7 days or less",
_diff <=30 , " Cleared in 8 to 30 days",
_diff <=60 , " Cleared in 31 to 60 days",
_diff <=90, " Cleared in 61 to 90 days",
_diff <=120, " Cleared in 91 to 120 days",
_diff >120, "Cleared in 120 days or more"
--_diff =blank(), "remaining open"
)
- Greg_Deckler2 years agoCommunity Champion
Delguy87 That was short-hand. The actual code would have been _diff >= 0 && _diff <= 7