Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.
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
Solved! Go to Solution.
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
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
Try something like this:
End date = [Starting Date] + #duration(0, [Period], 0, 0)
https://community.powerbi.com/t5/Desktop/How-to-add-hours-to-DateTime-data/td-p/104443
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
76 | |
75 | |
70 | |
47 | |
41 |
User | Count |
---|---|
64 | |
41 | |
31 | |
30 | |
28 |