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
dnsia
Helper II
Helper II

How to calculate roundtrip time (in days) for a voyage of vessels?

Hi all,

I need help for the DAX measure to calculate all values in Total column for all the same vessels (Vessel column) with same voyage number (voyage column)

Example below, VES 1 202001 (start and return port : PORT A) has to add 209, 49 and 61 in total time column to show RT(roundtrip) hours as 319 which needs to be further converted to its days equivalent.

VESSELVOYAGELoadLoad ArrivalLoad DeparturePort (h)DischargeDisch ArrivalDisch DepartureTransit (h)Total(h)RT HoursRT  Days
VES 1202001PORT A1/2/2020 15:541/9/2020 18:19171PORT B1/11/2020 8:361/12/2020 3:0738209  
VES 1202001PORT B1/11/2020 8:361/12/2020 3:0719PORT C1/13/2020 9:331/14/2020 0:303049  
VES 1202001PORT C1/13/2020 9:331/14/2020 0:3015PORT A1/15/2020 22:181/19/2020 11:00466131913
VES 3202001PORT A2/18/2020 8:002/18/2020 20:0012PORT F2/22/2020 10:352/22/2020 22:068698  
VES 2202005PORT A2/19/2020 8:382/21/2020 10:3050PORT D2/22/2020 20:002/24/2020 4:003484  
VES 3202001PORT F2/22/2020 10:352/22/2020 22:0612PORT G2/26/2020 6:002/27/2020 22:008092  
VES 2202005PORT D2/22/2020 20:002/24/2020 4:0032PORT E2/25/2020 7:462/26/2020 1:482759  
VES 2202005PORT E2/25/2020 7:462/26/2020 1:4818PORT A2/27/2020 12:002/29/2020 23:0035531968
VES 3202001PORT G2/26/2020 6:002/27/2020 22:0040PORT A2/29/2020 23:363/2/2020 8:36498927912



Thank you in advance for your help!


Regards,
Dina

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @dnsia ,

 

Let me know if this works.

 

Create Measures in Power BI.

 

Total Hrs = Sum('Table'[Total(h)])

 

To Days = 
var DayNo =INT([Total Hrs]/24)
var HourNo=INT((Mod([Total Hrs],24)))
return
DayNo &  " day "  & FORMAT(HourNo,"#00")& " hours"

 

 

1.jpg

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

1 REPLY 1
harshnathani
Community Champion
Community Champion

Hi @dnsia ,

 

Let me know if this works.

 

Create Measures in Power BI.

 

Total Hrs = Sum('Table'[Total(h)])

 

To Days = 
var DayNo =INT([Total Hrs]/24)
var HourNo=INT((Mod([Total Hrs],24)))
return
DayNo &  " day "  & FORMAT(HourNo,"#00")& " hours"

 

 

1.jpg

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

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.