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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rhaddad87
Helper I
Helper I

Convert excel formula for time conversion in power query

Hi, community!  I have a query where I need to add a custom column to match what my excel spreadsheet does, the formula is:

 

IF(MOD(24*MOD(TEXT([#"Land Time (Military Time)"],"00\:00")-TEXT([#"Take Off Time (Military Time)"],"00\:00"),1),1)<0.6,24*MOD(TEXT([#"Land Time (Military Time)"],"00\:00")-TEXT([#"Take Off Time (Military Time)"],"00\:00"),1),((1440*MOD(TEXT([#"Land Time (Military Time)"],"00\:00")-TEXT([#"Take Off Time (Military Time)"],"00\:00"),1))-1)/60))

 

Is this easy to convert to a Power Query expression?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@rhaddad87 , With help from Duration

 

Duration.Days([Military Time])*24 + Duration.Hours([Military Time])+ Duration.Minutes([Military Time])/60.0 + Duration.Minutes([Military Time])/3600.0

 

Change formula as per need

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@rhaddad87 , With help from Duration

 

Duration.Days([Military Time])*24 + Duration.Hours([Military Time])+ Duration.Minutes([Military Time])/60.0 + Duration.Minutes([Military Time])/3600.0

 

Change formula as per need

Thank you so much, Amit!  You are truly a rockstar in this community @amitchandak 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors