Convert Excel fx to a Power Query fx

RattlingCarp3048

Board Regular
Joined
Jan 12, 2022
Messages
202
Office Version
  1. 365
Platform
  1. Windows
in my table i have 2 date/time columns and need to calculate the difference between them in hours. I manually entered this formula into a newly added custom column directly in the table. however, i would like the power query to do the calculation instead. how do i convert this excel function into something the power query custom column will accept?

=IF(OR([@ACS]="",[@GPU]=""),"NO SCAN",(NETWORKDAYS([@ACS],[@GPU],Table3[Holidays])-1-MOD([@ACS],1)+MOD([@GPU],1))*24)

expected outcome
ACSGPUACS to GPU (Hours)
5/23/2024 10:18​
5/24/2024 13:46​
27.48​
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
***site will not let me edit original post**

I found that adding a new custom column with a simple (startdate - enddate)*24 then change the data type to decimal and round will calculate to hours like i need which is much easier than i thought (yay!!).... problem that still remains is how do i exclude weekends and holidays??

**with 5/27/24 as a holiday**
1718911745666.png
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top