Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Ticket Aging Trend

I have 2 tables (one is a Calendar table and the other is a table of tickets).  I am trying to create a chart that shows on a monthly basis, how many tickets fall into different aging buckets, such a...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Anonymous,

    Extending parry2k's idea with the pattern from https://www.powerpivotpro.com/2013/04/counting-active-rows-in-a-time-period-guest-post-from-chris-campbell/, you can get close with this sort of approach (change the DATEDIFFs to suit), though it's nasty messy:

    30-59 days = 
    CALCULATE (
        COUNTROWS ( 'Tickets' ),
        FILTER (
            Tickets,     
                Tickets[CreatedDate] <= LASTDATE ( Dates[Date] )
                    && (
                        Tickets[Closed Date] >= FIRSTDATE ( Dates[Date] )
                            || Tickets[Closed Date] = BLANK ())
                    && (
            		DATEDIFF (
                        Tickets[CreatedDate],
                        IF (
                            Tickets[Closed Date] = BLANK ()
                                || Tickets[Closed Date] > LASTDATE ( Dates[Date] ),
                            LASTDATE ( Dates[Date] ),
                            Tickets[Closed Date]
                        ),
                        DAY
                    )
                        >= 30
                    && DATEDIFF (
                        Tickets[CreatedDate],
                        IF (
                            Tickets[Closed Date] = BLANK ()
                                || Tickets[Closed Date] > LASTDATE ( Dates[Date] ),
                            LASTDATE ( Dates[Date] ),
                            Tickets[Closed Date]
                        ),
                        DAY
                    )
                        < 60
            )
        )
    )