cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

## Date/Time + Decimal number [number of hours] to get result in Date/Time

Hello,

I need to calculate the Starting date and time + period (in hours) to get the result in date/time.

My data setting is following:

 Starting Date [Date/Time dd:mm:yyyy hh:nn:ss Period (Decimal number in hours) End date (Starting date + period) 1.1.2020 97 ??

I tried to conver the Period in Decimal numbers to Time format, but it doesn't work for higher values.

Thanks for help.

Petr

1 ACCEPTED SOLUTION
Community Support

Hi @Anonymous ,

You can use the following measure:

``````End date =
VAR vday =
INT ( MAX ( 'Table'[Period] ) / 24 )
VAR vSeconds =
MOD ( MAX ( 'Table'[Period] ), 24 ) * 3600
VAR vMinutes =
INT ( vSeconds / 60 )
VAR vRemainingSeconds =
MOD ( vSeconds, 60 )
VAR vHours =
INT ( vMinutes / 60 )
VAR vRemainingMinutes =
MOD ( vMinutes, 60 )
RETURN
MAX ( 'Table'[Starting Date] ) + vday
+ TIME ( vHours, vRemainingMinutes, vRemainingSeconds )``````

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,

Dedmon Dai

2 REPLIES 2
Community Support

Hi @Anonymous ,

You can use the following measure:

``````End date =
VAR vday =
INT ( MAX ( 'Table'[Period] ) / 24 )
VAR vSeconds =
MOD ( MAX ( 'Table'[Period] ), 24 ) * 3600
VAR vMinutes =
INT ( vSeconds / 60 )
VAR vRemainingSeconds =
MOD ( vSeconds, 60 )
VAR vHours =
INT ( vMinutes / 60 )
VAR vRemainingMinutes =
MOD ( vMinutes, 60 )
RETURN
MAX ( 'Table'[Starting Date] ) + vday
+ TIME ( vHours, vRemainingMinutes, vRemainingSeconds )``````

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,

Dedmon Dai

Helper III

Try something like this:

End date = [Starting Date] + #duration(0, [Period], 0, 0)

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.