Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have to calulate Average Turn Around time between DEACTIVATED & ACTIVATED status for each unique "Alert type".
Eg: Rows 1 to 26 is one Alert type, but i have many tickets Activated & deactivated for the same, All i need is to see how is the Average TAT time maintained in each alert type.
Also, If alert type doesnot have deactived status, the TAT should not be calculated...
I am not sure how to handle this case, Can anyone help with this
Solved! Go to Solution.
Hi @Anonymous ,
What is the calculation you need to do exactly? do you need to calculate the time difference between each status and then the average?
Please see this post regarding How to Get Your Question Answered Quickly (courtesy of @Greg_Deckler) and How to provide sample data in the Power BI Forum (courtesy of @ImkeF).
Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous ,
According to my understanding, you want to calculate the average time calculated by deactived time - activated time of each AlertType ,right?
You could follow these steps:
1. Add a rank column to table:
Rank =
VAR a = [Alert Type]
VAR t1 =
FILTER ( ALL ( 'Table' ), 'Table'[Alert Type] = a )
RETURN
RANKX ( t1, RANKX ( t1, [Time],, ASC, SKIP ),, ASC, SKIP )
2. Use the following formula to create a calculated table:
New Table =
VAR _t1 =
ADDCOLUMNS (
SELECTCOLUMNS (
CALCULATETABLE ( 'Table', 'Table'[Status] = "Activated" ),
"AlertType", [Alert Type],
"Ac", [Time],
"Index", [Rank]
),
"De",
LOOKUPVALUE (
'Table'[Time],
'Table'[Alert Type], [AlertType],
'Table'[Rank], [Index] + 1
)
)
RETURN
ADDCOLUMNS ( _t1, "TimeDiff", DATEDIFF ( [Ac], [De], SECOND ) )
3. Calculate the average time
Average Measure =
CALCULATE (
AVERAGE ( 'New Table'[TimeDiff] ),
FILTER ( 'New Table', 'New Table'[AlertType] = MAX ( 'New Table'[AlertType] ) )
)
Or
Average Column =
CALCULATE (
AVERAGE ( 'New Table'[TimeDiff] ),
ALLEXCEPT ( 'New Table', 'New Table'[AlertType] )
)
The final output is shown below:
Please take a look at the pbix file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
According to my understanding, you want to calculate the average time calculated by deactived time - activated time of each AlertType ,right?
You could follow these steps:
1. Add a rank column to table:
Rank =
VAR a = [Alert Type]
VAR t1 =
FILTER ( ALL ( 'Table' ), 'Table'[Alert Type] = a )
RETURN
RANKX ( t1, RANKX ( t1, [Time],, ASC, SKIP ),, ASC, SKIP )
2. Use the following formula to create a calculated table:
New Table =
VAR _t1 =
ADDCOLUMNS (
SELECTCOLUMNS (
CALCULATETABLE ( 'Table', 'Table'[Status] = "Activated" ),
"AlertType", [Alert Type],
"Ac", [Time],
"Index", [Rank]
),
"De",
LOOKUPVALUE (
'Table'[Time],
'Table'[Alert Type], [AlertType],
'Table'[Rank], [Index] + 1
)
)
RETURN
ADDCOLUMNS ( _t1, "TimeDiff", DATEDIFF ( [Ac], [De], SECOND ) )
3. Calculate the average time
Average Measure =
CALCULATE (
AVERAGE ( 'New Table'[TimeDiff] ),
FILTER ( 'New Table', 'New Table'[AlertType] = MAX ( 'New Table'[AlertType] ) )
)
Or
Average Column =
CALCULATE (
AVERAGE ( 'New Table'[TimeDiff] ),
ALLEXCEPT ( 'New Table', 'New Table'[AlertType] )
)
The final output is shown below:
Please take a look at the pbix file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
What is the calculation you need to do exactly? do you need to calculate the time difference between each status and then the average?
Please see this post regarding How to Get Your Question Answered Quickly (courtesy of @Greg_Deckler) and How to provide sample data in the Power BI Forum (courtesy of @ImkeF).
Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @sharm ,
Looking at the data you have provided you need to do the following steps on the query editor:
[Time Received] - (if [IndexAllRows] = 0 then null else if #"Changed Type" {[IndexAllRows] - 1} [Index] = #"Changed Type" {[IndexAllRows] } [Index] then #"Changed Type" {[IndexAllRows] - 1} [Time Received] else null )
Now just load the values on the PBI and you can then create the following measure using dax:
Average time =
FORMAT (
TIME ( TRUNC ( AVERAGE ( 'Table'[Duration previous stage] ); 0 ); (
AVERAGE ( 'Table'[Duration previous stage] )
- TRUNC ( AVERAGE ( 'Table'[Duration previous stage] ); 0 )
) * 60; 0 );
"short time"
)
Check PBIX file attach.
If this works please tell me so I can post the answer and you can accept it so it can help others.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |