Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

EARLIER chalenge

Hello Power friends,   I have a table with IT tickets like that: Id_ticket, date, old_status, new_status,days_to_fix 100,01/01/2018,<blank>,"new ticket" ,0 // user report a problem opening a tick...
  • Chihiro's avatar
    Chihiro
    7 years ago

    Greg gave you the basic construct, and link explaining the concept.

     

    You'll just need to change RETURN portion to only return result when [new_status]="fixed".

     

    So...

     

    Column =
    VAR __max =
        MAXX (
            FILTER (
                ALL ( 'Table' ),
                [Id_ticket] = EARLIER ( [Id_ticket] )
                    && [date] < EARLIER ( [date] )
                    && [new_status] = EARLIER ( [old_status] )
            ),
            [date]
        )
    RETURN
        IF ( [new_status] = "fixed", [date] - __max, 0 )

    Result