Forum Discussion
Anonymous
7 years agoNot applicable
Find time between one fixed row and one variable row
Hello, I hope some can help me, i have a data table with this columns - TicketID - Ticket creation date - Last action - Date/time of last action Actions can be things like giving a priority t...
- 7 years ago
Hi Anonymous,
It looks like there existing more than one records where Action is set to "Set Priority to regular" per Ticket ID. If so, please try below suggestion.
First, add a calculated column in Table1.
Index = RANKX ( FILTER ( 'Table1', Table1[TicketID] = EARLIER ( Table1[TicketID] ) ), Table1[Action date/time], , ASC, DENSE )Then, add measure [Average] into a card visual.
Timediff = VAR _CurrentActiontime = SELECTEDVALUE ( Table1[Action date/time] ) VAR _NextActiontime = CALCULATE ( SELECTEDVALUE ( Table1[Action date/time] ), FILTER ( ALLEXCEPT ( Table1, Table1[TicketID] ), Table1[Index] = MAX ( Table1[Index] ) + 1 ) ) VAR diff = IF ( SELECTEDVALUE ( Table1[Action] ) = "Set priority to regular", DATEDIFF ( _CurrentActiontime, _NextActiontime, SECOND ), BLANK () ) RETURN diff
Average =
AVERAGEX ( ALLSELECTED ( Table1 ), [Timediff] )Best regards,
Yuliana Gu
v-yulgu-msft
7 years agoMicrosoft Employee
Hi Anonymous,
It looks like there existing more than one records where Action is set to "Set Priority to regular" per Ticket ID. If so, please try below suggestion.
First, add a calculated column in Table1.
Index =
RANKX (
FILTER ( 'Table1', Table1[TicketID] = EARLIER ( Table1[TicketID] ) ),
Table1[Action date/time],
,
ASC,
DENSE
)
Then, add measure [Average] into a card visual.
Timediff =
VAR _CurrentActiontime =
SELECTEDVALUE ( Table1[Action date/time] )
VAR _NextActiontime =
CALCULATE (
SELECTEDVALUE ( Table1[Action date/time] ),
FILTER (
ALLEXCEPT ( Table1, Table1[TicketID] ),
Table1[Index]
= MAX ( Table1[Index] ) + 1
)
)
VAR diff =
IF (
SELECTEDVALUE ( Table1[Action] ) = "Set priority to regular",
DATEDIFF ( _CurrentActiontime, _NextActiontime, SECOND ),
BLANK ()
)
RETURN
diff
Average =
AVERAGEX ( ALLSELECTED ( Table1 ), [Timediff] )
Best regards,
Yuliana Gu
- Anonymous7 years agoNot applicable
v-yulgu-msft this does the trick! Thank you very much for your help!
AlB also many thanks for all your help!