Byrdwatcher1978
Byrdwatcher1978

Reputation: 23

PowerBi, time in hours plus 2

I have a table with start time and I would like to take just the hour part and then add 2 hours to it. So in Start time I have 21.04.2016 07:00:40 and then the result in the new column would be 09:00:00

I've called the new column: HourPart HourPart = TIME(Hour([StartTime]); 0; 0)

This however gives me 30.12.1899 07:00:00

Can someone point me in the right direction?

Thanks

Upvotes: 1

Views: 78

Answers (2)

Byrdwatcher1978
Byrdwatcher1978

Reputation: 23

Ok resolved it: I created a new column:

New Again = [StartTime] + Time(2;0;0)

Then another column:

HourPart = FORMAT([New Again]; "hh:mm:ss")

Upvotes: 1

Trubs
Trubs

Reputation: 3032

You could do it in a single column rather than creating a junk column as an interim step:

HourPart =
FORMAT ( [StartTime] + TIME ( 2, 0, 0 ), "hh:mm:ss" )

(using semi-colons for the delimiter in the time function if your locale is set that yas

Upvotes: 0

Related Questions