Forum Discussion
Arroios2020
6 years agoRegular Visitor
Calculate Response Time each time
Hi I am having trouble to calculate the response time of each message. I have ID_Conversation for each conversation and a conversation can have multiple messagas (Content column). The column is_by_...
- 6 years ago
Hi Arroios2020
Column = RANKX ( FILTER ( 'Table', 'Table'[Id_Conversations] = EARLIER ( 'Table'[Id_Conversations] ) ), [Created_DateTime], , ASC, DENSE ) Column 2 = CALCULATE ( MAX ( 'Table'[Created_DateTime] ), FILTER ( 'Table', 'Table'[Id_Conversations] = EARLIER ( 'Table'[Id_Conversations] ) && 'Table'[Column] = EARLIER ( 'Table'[Column] ) - 1 ) ) Column 3 = VAR ts = IF ( [Column 2] <> BLANK (), DATEDIFF ( [Column 2], [Created_DateTime], SECOND ) ) VAR h = INT ( ts / 3600 ) VAR d = INT ( h / 24 ) VAR m = INT ( MOD ( ts, 3600 ) / 60 ) VAR s = ts - h * 3600 - m * 60 VAR hh = IF ( LEN ( h ) = 1, 0 & h, h ) VAR mm = IF ( LEN ( m ) = 1, 0 & m, m ) VAR ss = IF ( LEN ( s ) = 1, 0 & s, s ) RETURN IF ( [Column 2] <> BLANK (), IF ( d = BLANK (), hh & ":" & mm & ":" & ss, d & " " & hh & ":" & mm & ":" & ss ) )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-juanli-msft
6 years agoCommunity Support
Hi Arroios2020
Column =
RANKX (
FILTER (
'Table',
'Table'[Id_Conversations] = EARLIER ( 'Table'[Id_Conversations] )
),
[Created_DateTime],
,
ASC,
DENSE
)
Column 2 =
CALCULATE (
MAX ( 'Table'[Created_DateTime] ),
FILTER (
'Table',
'Table'[Id_Conversations] = EARLIER ( 'Table'[Id_Conversations] )
&& 'Table'[Column]
= EARLIER ( 'Table'[Column] ) - 1
)
)
Column 3 =
VAR ts =
IF (
[Column 2] <> BLANK (),
DATEDIFF ( [Column 2], [Created_DateTime], SECOND )
)
VAR h =
INT ( ts / 3600 )
VAR d =
INT ( h / 24 )
VAR m =
INT ( MOD ( ts, 3600 ) / 60 )
VAR s = ts - h * 3600 - m * 60
VAR hh =
IF ( LEN ( h ) = 1, 0 & h, h )
VAR mm =
IF ( LEN ( m ) = 1, 0 & m, m )
VAR ss =
IF ( LEN ( s ) = 1, 0 & s, s )
RETURN
IF (
[Column 2] <> BLANK (),
IF (
d = BLANK (),
hh & ":" & mm & ":" & ss,
d & " " & hh & ":" & mm & ":" & ss
)
)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SaraID
2 years agoNew Member
This worked great! But, I need help now converting that column from text to time. Thanks!