Forum Discussion

ccindyp's avatar
ccindyp
Frequent Visitor
2 years ago
Solved

Calculating date difference between a column and a dynamic date from a user filter

Hello,   I have a tickets table as shown below. I need every week to report on the unupdated tickets from the last 2 weeks.  Example: How many open tickets were not modified by the support team wi...
  • ccindyp's avatar
    2 years ago

    Hello, I did try a few formulas and it seems to work. I am sharing the formulas in case it helps other community members: 

    Total tickets =

    CALCULATE(

        DISTINCTCOUNT(‘Ticket table’ [Ticket]),

        USERELATIONSHIP('Calendar'[Date], ' Ticket table'[Date Open])

    )

    --------------------

     

    Open tickets =

    VAR EndDatePervisual = MAX('Calendar'[Date])

    VAR Result =

    CALCULATE(

        [Total tickets],

        REMOVEFILTERS ('Calendar'),

        ‘Ticket table’[Date open]<= EndDatePervisual,

        ‘Ticket table’[Date resolved] > EndDateperVisual

        ||

        ISBLANK(‘Ticket table’[Date resolved])

        )

     

    RETURN

    Result

    --------------

    Total open tickets =

    CALCULATE(

        [Open tickets],

        USERELATIONSHIP('Calendar'[Date], ‘Ticket table’[Date open]),

        FILTER('Dim - Status', 'Dim - Status'[Status] = "Open"||'Dim - Status'[Status] = "Processing")

    )

    ----------------

    Unupdated issues last 2 weeks =

    VAR TwoWeeksAgo = [Week End Date] - 14

    RETURN

    CALCULATETABLE(

        ROW(

        "Total open tickets", [Total open tickets]

        ),

        KEEPFILTERS( FILTER( ALL( ‘Ticket table’[Changed On] ), ‘Ticket table’[Changed On] <= TwoWeeksAgo )))

     

    There can be other options to reahc the same results, if anybody can share any alternative, I would be happy to hear 🙂

     

    Thanks and have a nice day