• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Power Query - Adding 2 Time columns

Greenbriars

Member
I am preparing a dashboard using data provided by a call centre. As part of this process I need to add 2 time fields together. They represent the time taken to deal with the incoming call and the time the call is transferred, if that is appropriate.

Being a relative newcomer to Power Query I expected to be able to add a custom column and add the 2 time columns together to get what I wanted. However when I did this I received a column full of errors and the error was as follows, there was no syntax error:

Expression.Error: We cannot apply operator + to types Time and Time.
Details:
Operator=+
Left=00:02:39
Right=00:01:50

If I tried to subtract one from the other it worked, although that was obviously not what I wanted.

I solved the problem by transforming both times to numbers, adding the 2 column to get 3 numerical columns and then converting them all to times.

I have looked through Google to try to find an answer to this conundrum, but with no success.

Am I just being dim?

I hope someone can enlighten me.

Regards,

Alan
 
It looks like the difference between data types time and duration. Could you attach a simple workbook making it clear where it's going wrong and I should be able to tweak code?
 
In PQ, Time value is always indicated by AM/PM suffix. But at any rate, you cannot use addition operator on two time values.
Lets say you have 23:50:00 and 22:00:00 as times. You can find the difference between the two times.
But it does not make sense to add two different time values (however, you can add two different datetime values as this does not set upper bound for the value stored).

You should first convert it to duration value before you add these two columns.
 
Back
Top