Forum Discussion

RohithGn's avatar
RohithGn
Helper I
9 years ago
Solved

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...
  • MarcelBeug's avatar
    MarcelBeug
    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.