Forum Discussion
How to calculate Date + time
- 6 years ago
Hi Anonymous ,
You can use the following measure to convert Decimal number [in hours] to Time value
Measure = VAR vSeconds = MAX ( 'Table'[Hours] ) * 3600 VAR vMinutes = INT ( vSeconds / 60 ) VAR vRemainingSeconds = MOD ( vSeconds, 60 ) VAR vHours = INT ( vMinutes / 60 ) VAR vRemainingMinutes = MOD ( vMinutes, 60 ) RETURN 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
Hi,
I've found the different issue.
I have the Number of hours in decimal number, which I transfer to time format. But if decimal nubmer is higher than 24, the time is then incorrect.
So I need to calculate following vallues:
Column A: Date/Time [dd:mm:yy hh:mm:ss]
Column B: Decimal number [in hours]
I need to calculate columna A + B to get result in Date/Time.
Thanks
Petr
Hi Anonymous ,
You can use the following measure to convert Decimal number [in hours] to Time value
Measure =
VAR vSeconds =
MAX ( 'Table'[Hours] ) * 3600
VAR vMinutes =
INT ( vSeconds / 60 )
VAR vRemainingSeconds =
MOD ( vSeconds, 60 )
VAR vHours =
INT ( vMinutes / 60 )
VAR vRemainingMinutes =
MOD ( vMinutes, 60 )
RETURN
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