The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi everyone,
I want to find out how long the tickets in our system are open for on average.
Tickets have a CreatedDate and what I want to find out is how much time lapses between created and closed, and then calculate an average per month.
How would I structure this? It should be a combination of RefereneceNo (which is the ticket number), CreatedDate, ClosedDateTime and a calculation somehow to get the average?
Thank you for all your expertise!
Hi @Anonymous,
To calculate the average time it takes for a ticket to be closed, you'll need to:
Here are the steps to create the calculated column:
Open Power BI and connect to your data source.
Click on the "Transform data" button to open Power Query Editor.
Select the table that contains the ticket data.
Click on the "Add column" tab in the ribbon and select "Custom column".
In the "Custom column" dialog, enter a name for the column, such as "TimeToClose".
In the "Custom column formula" field, enter the following formula:
= if [ClosedDateTime] = null then null else [ClosedDateTime] - [CreatedDate]
This formula checks if the ticket has been closed. If it has, it calculates the time difference between the CreatedDate and ClosedDateTime columns. If the ticket is still open, the formula returns null.
Click "OK" to create the new column.
Here are the steps to create the measure:
Click on the "Report" tab to return to the report view.
Click on the "New measure" button in the "Fields" pane.
In the formula bar, enter the following formula:
AverageTimeToClose = AVERAGEX('table_name', 'table_name'[TimeToClose])
Replace "table_name" with the name of the table that contains the ticket data.
Click on the "Modeling" tab and select "Month" from the "Date" dropdown to group the measure by month.
You can now add the AverageTimeToClose measure to your report, and it will display the average time it takes to close a ticket per month.
Best regards,
Isaac Chavarria
If this post helps, then please consider Accepting it as the solution and give Kudos to help the other members find it more quickly