Forum Discussion
Bu__
2 years agoFrequent Visitor
Find duration spent between 2 dates in multiple rows
Have a data like below Ticket num Created Ticket_1 11/3/2022 0:06 Ticket_1 11/3/2022 0:18 Ticket_1 11/3/2022 0:21 Ticket_1 11/3/2022 0:22 Ticket_1 11/3/2022 0:23 Ticket_1 ...
- 2 years ago
Hi,
I am not sure if I understodd your question correctly, but I tried to create a sample pbix file like below.
It is for creating a new column, and the result is described in Second.
Please check the below picture and the attached pbix file.
OFFSET function (DAX) - DAX | Microsoft Learn
COALESCE function (DAX) - DAX | Microsoft Learn
expected reuslt CC = VAR _currentdatetime = Data[Created] VAR _nextdatetime = MAXX ( OFFSET ( 1, SUMMARIZE ( Data, Data[Ticket num], Data[Created] ), ORDERBY ( Data[Created], ASC ), , PARTITIONBY ( Data[Ticket num] ) ), Data[Created] ) RETURN COALESCE ( DATEDIFF ( _currentdatetime, _nextdatetime, SECOND ), 0 )
Jihwan_Kim
2 years agoSuper User
Hi,
I am not sure if I understodd your question correctly, but I tried to create a sample pbix file like below.
It is for creating a new column, and the result is described in Second.
Please check the below picture and the attached pbix file.
OFFSET function (DAX) - DAX | Microsoft Learn
COALESCE function (DAX) - DAX | Microsoft Learn
expected reuslt CC =
VAR _currentdatetime = Data[Created]
VAR _nextdatetime =
MAXX (
OFFSET (
1,
SUMMARIZE ( Data, Data[Ticket num], Data[Created] ),
ORDERBY ( Data[Created], ASC ),
,
PARTITIONBY ( Data[Ticket num] )
),
Data[Created]
)
RETURN
COALESCE ( DATEDIFF ( _currentdatetime, _nextdatetime, SECOND ), 0 )