Forum Discussion
RohithGn
9 years agoHelper I
Custom columns with timestamps and date transformations
Hi All, I am working on a report in which we have 3 columns containing timestamps - Opened, Resolved & Closed. Our concern is with the null values in Resolved column. I am trying to create a cust...
- 9 years ago
DanielV91 there are some superfluous checks in your code: if a condition is not true, then you don't need to check in the else part if the condition is false.
Assuming the data is correct, your code can be shortened to:
if [Resolved] <> null then [Resolved] else if [Closed] = null then [Opened] else Date.AddDays([Closed],-7)
Note: Date.AddDays can also be used with datetime type data, so no need to convert to date.
MarcelBeug
9 years agoCommunity Champion
DanielV91 there are some superfluous checks in your code: if a condition is not true, then you don't need to check in the else part if the condition is false.
Assuming the data is correct, your code can be shortened to:
if [Resolved] <> null then [Resolved] else if [Closed] = null then [Opened] else Date.AddDays([Closed],-7)
Note: Date.AddDays can also be used with datetime type data, so no need to convert to date.
RohithGn
9 years agoHelper I
Thanks a ton MarcelBeug your code is working as expected
DanielV91 Thanks a lot for the reply :)