Forum Discussion
Measure to finde time difference between two ordered timestamps within one category
- 3 years ago
Hi charlineklapu .
According to your description, here is my solution, and please follow these steps.
Firstly, process the data and make sure that your columns "Opened on" and "Timestamp" are Date/time format.
And then use Power Query to add an index column.
And then create a calculated column.
Column = VAR _a = CALCULATE ( MAX ( 'Table'[Timestamp] ), FILTER ( 'Table', [Index] = EARLIER ( 'Table'[Index] ) + 1 ) ) VAR _b = DATEDIFF ( _a, [Timestamp], HOUR ) VAR _c = CALCULATE ( MIN ( 'Table'[Timestamp] ), FILTER ( 'Table', [Customer] = EARLIER ( 'Table'[Customer] ) && [Timestamp] > EARLIER ( 'Table'[Timestamp] ) ) ) RETURN SWITCH ( TRUE (), [Status] = "Request Processed" && ISBLANK ( _c ), "FCR", [Status] = "Request Processed" && _b > 24, "FCR", [Status] = "Request Processed" && _b < 24, "n.FCR" )Final output:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ xiaosunIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi charlineklapu .
According to your description, here is my solution, and please follow these steps.
Firstly, process the data and make sure that your columns "Opened on" and "Timestamp" are Date/time format.
And then use Power Query to add an index column.
And then create a calculated column.
Column =
VAR _a =
CALCULATE (
MAX ( 'Table'[Timestamp] ),
FILTER ( 'Table', [Index] = EARLIER ( 'Table'[Index] ) + 1 )
)
VAR _b =
DATEDIFF ( _a, [Timestamp], HOUR )
VAR _c =
CALCULATE (
MIN ( 'Table'[Timestamp] ),
FILTER (
'Table',
[Customer] = EARLIER ( 'Table'[Customer] )
&& [Timestamp] > EARLIER ( 'Table'[Timestamp] )
)
)
RETURN
SWITCH (
TRUE (),
[Status] = "Request Processed"
&& ISBLANK ( _c ), "FCR",
[Status] = "Request Processed"
&& _b > 24, "FCR",
[Status] = "Request Processed"
&& _b < 24, "n.FCR"
)
Final output:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ xiaosun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.