Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Juzdeppe
Regular Visitor

Avg days open for open tickets only_3 mth rolling

Hello Everyone,
I hope you can help me with my topic.

I've been trying to formulate a solution to one problem for some time now. I want to count avg days open for tickets in system for individual weeks. However, I am not talking about the result of the average time for closed tickets, but for those that were still open in a given week: 
(Sum of the days open of all open tickets) / (Count of open tickets). Time is calculated from date ticket is entered in the system to date of calculation. 

The data I work on is updated daily. So a ticket that was still open one day may already have a closing date the next day.
Then given the average days open result for each week, I need to count the 3 month rolling result (last 12 weeks).

Sample table with data. If the "Close Date" is blanc then the ticket is still open:

Create DateTicket NumberClose Date
07.03.20228015974030.06.2023
19.05.202280160647 
29.06.20228016105704.04.2023
28.06.20228016108123.05.2023
04.07.202280161108 
25.07.20228016138923.05.2023
09.08.20228016168604.04.2023
19.08.202280161792 
25.08.20228016190219.04.2023
12.09.20228016201625.04.2023
13.09.20228016201724.04.2023
13.10.202280162496 
13.10.20228016249803.04.2023
14.10.20228016252818.04.2023
01.11.202280162756 
11.11.20228016293512.04.2023
11.11.20228016293612.04.2023
22.11.20228016309323.05.2023



I will be very grateful for your help!




1 REPLY 1
johnt75
Super User
Super User

You could create a couple of measures like

Weekly avg open cases =
VAR ReferenceDate =
    MAX ( 'Date'[Date] )
VAR OpenTickets =
    CALCULATETABLE (
        VALUES ( 'Table'[Ticket ID] ),
        'Table'[Create date] <= ReferenceDate,
        ISBLANK ( 'Table'[Close date] )
            || 'Table'[Close date] > ReferenceDate
    )
VAR NumDaysOpen =
    CALCULATE (
        SUMX (
            'Table',
            DATEDIFF (
                'Table'[Create date],
                COALESCE ( 'Table'[Close date], ReferenceDate ),
                DAY
            )
        ),
        OpenTickets
    )
VAR NumOpenTickets =
    COUNTROWS ( OpenTickets )
VAR Result =
    DIVIDE ( NumDaysOpen, NumOpenTickets )
RETURN
    Result


3 month average =
VAR ReferenceDate =
    MAX ( 'Date'[Date] )
VAR DatesToUse =
    CALCULATETABLE (
        VALUES ( 'Date'[Week commencing] ),
        DATESBETWEEN ( 'Date'[Date], ReferenceDate - 84, ReferenceDate )
    )
VAR Result =
    AVERAGEX ( DatesToUse, [Weekly avg open cases] )
RETURN
    Result

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.