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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
TaroGulati
Helper III
Helper III

Time difference two tables

Hi all, 

 

I am having difficulty in calculating the time difference between two tables. 

TaroGulati_1-1737060973192.png

 

I need to calculate sum of time difference from table 2 between type A and B which is 21 min. This i calulated without any issue. challange is from these 21 min i have to subtract the time difference using table 1 only for the period which falls under the different dates for type A and B from table 2. For e.g from table 1 i don't have to consider row number 1 because start and end date is out of scope between dates in table 2. From table 1, row 2 and 3 should be considered because they fall under the date between row 3 and 4 of table 2. so from 21 min of table 2 i have to subtract only 11 minutes (6 minutes of row 2 and 5 minutes from row 3) from table 1. 

 

In the data model there is a possibility of relation between table 1 and 2.

Any idea how to achieve this? 

Thanks

10 REPLIES 10
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the file.  Show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur i uploaded the file at this link. Power BI

 

Please let me know if you can access

Clearly show the end result which you are expecting.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the file.  Show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@TaroGulati 

How did you get the date difference column? did you use DAX to calcuate? 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi, that i calculated using the min date for A and min date B for each combination and then summed up. 

@TaroGulati 

pls see if this is what you want

 

11.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi, thanks for the feedback. in this case result should be 11 not 10. Agree?

@TaroGulati 

totally 21 mins, then substract 6 mins from row 2 and 5 mins from row 3.

21-6-5=10. 

if I misunderstood the calculation logic, pls correct me.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi, yes you are correct. 

Thanks

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.