Hi there,
I have two date-time columns. I want to calculate the difference between two date-time columns and return the result in minutes as third column in query editor. I am using following approach:
Time diff = Duration.Minutes([Date2] - [Date1])
The above approach produces the result if value is as follow:
For example: [Date1] = 5/16/2020 4:00:00 pm, [Date2] = 5/16/2020 4:45:00 pm
The above formula returns 45.
However, the problem comes in when the value is as follow:
For example: [Date1] = 5/12/2020 9:00:00 pm, [Date2] = 5/13/2020 1:00:00 am
then above formula returns 0.
The alternate approach I could think of is as follow:
Time diff = Duration.Hours([Date2] - [Date1]) * 60 + Duration.Minutes([Date2] - [Date1])
I was just wondering that is there any other efficient way of doing in power editor?