I want to get the average time from it's creation date to when it became done date and…
- User
I want to get the average time from it's creation date to when it became done date and status as done exceptions data. I have exception key, status , the date when exception became done
- Assistant
, and the date when it was created. To calculate the average time, you can use the following formula:
Average time = (Sum of time taken for each exception to become done status)/(Number of exceptions)
To calculate the time taken for each exception to become done status, you can subtract the created date from the done date. For example, if the created date is 2021-01-01 and the done date is 2021-01-05, the time taken would be 4 days.
To include only exceptions with a status of "done", you can filter the data based on the status column.
Here is an example code in Python:
import pandas as pd # Read the data into a pandas DataFrame data = pd.read_csv('exceptions.csv') # Filter the data by status column to only include "done" exceptions done_data = data[data['status'] == 'done'] # Calculate the time taken for each exception to become done done_data['time_taken'] = pd.to_datetime(done_data['done_date']) - pd.to_datetime(done_data['created_date']) # Calculate the average time taken for all done exceptions average_time = done_data['time_taken'].mean() print(f"The average time taken for all done exceptions is {average_time.days} days.") - User
I want to get the average time from it's creation date to when it became done date and status as donemy exceptions data. I have exception key, status , the date when exception became done in qliksense
- Assistant
To get the average time from creation date to done date for exceptions with a status of "done" in Qlik Sense, you can use the following steps:
- Load the exceptions data into Qlik Sense using a data load script or by connecting to a data source.
- Create a new field in the data model that calculates the time taken for each exception to become "done". This can be done using the
Interval()function, which calculates the duration between two dates. For example:
TimeTaken: Interval(DAY, CreatedDate, DoneDate) - User
will it consider all the exception with done status and then take the average time ?
- Assistant
Yes, if you apply the filter correctly to only include exception with a status of "done", then the average time taken will be calculated only for those exceptions that have a "done" status.
In Qlik Sense, using the set analysis syntax I mentioned, you can filter the data to only include exceptions with a "done" status. This means that only data that matches the criteria specified in the set analysis will be considered in the calculation. In this case, only exceptions with a "done" status will be considered for calculating the average time taken.
So, the calculation will exclude any exceptions that do not have a status of "done". This ensures that the average time taken is only calculated for the relevant subset of data.