Forum Discussion
Average Time between Repair Work orders
- 4 years ago
Hi SAU1111 ,
If the Repair Work Order Numbers is random like below:
You can create a column to rank the Closed Date for each Product Name and Serial Numbers of products, like this:
Rank = RANKX ( FILTER ( 'Table', 'Table'[Porduct Name] = EARLIER ( 'Table'[Porduct Name] ) && 'Table'[Serial Numbers of products] = EARLIER ( 'Table'[Serial Numbers of products] ) ), 'Table'[Repair Work Order Closed Date], , ASC, DENSE )Then create a measure.
Average Diff = VAR _T = ADDCOLUMNS ( 'Table', "Diff", DATEDIFF ( MAXX ( FILTER ( 'Table', 'Table'[Rank] = EARLIER ( 'Table'[Rank] ) - 1 && 'Table'[Porduct Name] = EARLIER ( 'Table'[Porduct Name] ) && 'Table'[Serial Numbers of products] = EARLIER ( 'Table'[Serial Numbers of products] ) ), 'Table'[Repair Work Order Closed Date] ), 'Table'[Repair Work Order Closed Date], DAY ) ) RETURN AVERAGEX ( _T, [Diff] )Get the result for each Product Name and Serial Numbers of products.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please considerAccept it as the solution to help the other members find it more quickly.
Hi SAU1111 ,
According to your descrption, I create a sample.
Here's my solution, create a measure.
Average Diff =
VAR _T =
ADDCOLUMNS (
'Table',
"Diff",
DATEDIFF (
MAXX (
FILTER (
'Table',
'Table'[Repair Work Order Numbers]
= EARLIER ( 'Table'[Repair Work Order Numbers] ) - 1
&& 'Table'[Porduct Name] = EARLIER ( 'Table'[Porduct Name] )
&& 'Table'[Serial Numbers of products]
= EARLIER ( 'Table'[Serial Numbers of products] )
),
'Table'[Repair Work Order Closed Date]
),
'Table'[Repair Work Order Closed Date],
DAY
)
)
RETURN
AVERAGEX ( _T, [Diff] )
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please considerAccept it as the solution to help the other members find it more quickly.