Forum Discussion

gopalv's avatar
gopalv
Microsoft Employee
6 years ago
Solved

Earliest response time GitHub issue

I have data that looks like this, and I want to calculate the date to first response of an issue, by taking the difference between the 2nd earliest value in the "date last updated" column and the ear...
  • v-juanli-msft's avatar
    6 years ago

    Hi gopalv 

    Create measures

    count =
    CALCULATE (
        COUNT ( 'Table'[issue number] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[issue number] = MAX ( 'Table'[issue number] )
        )
    )
    
    
    earliest =
    CALCULATE (
        MIN ( 'Table'[date last updated] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[issue number] = MAX ( 'Table'[issue number] )
        )
    )
    
    
    2nd earliest =
    CALCULATE (
        MIN ( 'Table'[date last updated] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[issue number] = MAX ( 'Table'[issue number] )
                && [date last updated] > [earliest]
        )
    )
    
    
    difference time = DATEDIFF([earliest],[2nd earliest],MINUTE)
    
    final =
    SWITCH (
        TRUE (),
        COUNT ( 'Table'[issue number] ) = 1, DATEDIFF ( MAX ( 'Table'[date last updated] ), TODAY (), DAY ) & " days",
        COUNT ( 'Table'[issue number] ) > 1, [difference time] & " minutes"
    )
    
    
    

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.