Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dbravo
Frequent Visitor

Calculate time difference with other rows

Hi,

 

I have a case tracking system that stores the date when a case passes from a state to another in a single row, then I want to calculate the duration time between state changes.

 

I have data like these:

 

id	case_id	date	state_id
25413857	802893	2017-06-01 00:00:02	1
25413858	802937	2017-06-01 00:00:02	1
25413859	889015	2017-06-01 00:00:08	1
25413860	889015	2017-06-01 00:00:57	2
25413861	889030	2017-06-01 00:01:43	1
25413862	889375	2017-06-01 00:01:59	1
25413863	889375	2017-06-01 00:02:00	2
25413864	889030	2017-06-01 00:02:18	2
25413865	889030	2017-06-01 00:02:19	3
25413866	889031	2017-06-01 00:02:36	1
25413867	889031	2017-06-01 00:03:20	2
25413868	889031	2017-06-01 00:03:21	3
25413869	889376	2017-06-01 00:03:23	1
25413870	889376	2017-06-01 00:03:24	2
25413871	889377	2017-06-01 00:03:46	1
25413872	889377	2017-06-01 00:03:47	2
25413873	889375	2017-06-01 00:03:50	3
25413874	889375	2017-06-01 00:03:52	4
25413875	889375	2017-06-01 00:04:02	5
25413876	889375	2017-06-01 00:04:03	6
25413877	889376	2017-06-01 00:04:54	3
25413878	889376	2017-06-01 00:04:55	4
25413879	889378	2017-06-01 00:05:08	1
25413880	889378	2017-06-01 00:05:09	2
25413881	889379	2017-06-01 00:05:21	1
25413882	889343	2017-06-01 00:05:27	1
25413883	889376	2017-06-01 00:05:27	5
25413884	889376	2017-06-01 00:05:32	6
25413885	802867	2017-06-01 00:05:38	1
25413886	889346	2017-06-01 00:05:42	1
25413887	889376	2017-06-01 00:05:43	7
25413888	889379	2017-06-01 00:05:51	2
25413889	888432	2017-06-01 00:06:02	1
25413890	889376	2017-06-01 00:06:07	8
25413891	889376	2017-06-01 00:06:08	9
25413892	888432	2017-06-01 00:06:09	2
25413893	889154	2017-06-01 00:06:31	1
25413894	889154	2017-06-01 00:06:32	2
25413895	889379	2017-06-01 00:06:33	3
25413896	889381	2017-06-01 00:06:38	1
25413897	889381	2017-06-01 00:06:39	2
25413898	889154	2017-06-01 00:06:40	3
25413899	889377	2017-06-01 00:06:46	3
25413900	889377	2017-06-01 00:06:48	4
25413901	889154	2017-06-01 00:06:52	4
25413902	889154	2017-06-01 00:06:53	5
25413903	889377	2017-06-01 00:06:55	5
25413904	889377	2017-06-01 00:06:56	6
25413905	889378	2017-06-01 00:07:29	3
25413906	889378	2017-06-01 00:07:30	4

 

I'm lost, I've tried using some DAX functions but I can't solve this, I hope you can help me.

 

Thanks in advance.

1 ACCEPTED SOLUTION

My video here should help you. https://m.youtube.com/watch?v=xN2IRXQ2CvI



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

1 REPLY 1

My video here should help you. https://m.youtube.com/watch?v=xN2IRXQ2CvI



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.