Forum Discussion
Time Calculation on Power BI
Hello,
https://i.hizliresim.com/3BQozh.jpg
How can I calculate total time the Minutes in the column?
Regards
Hi Anonymous ,
Sure, try this:
Total Time = VAR Seconds1 = SUMX ( 'ARRET', SECOND ( ARRET[Sure] ) ) VAR Minutes1 = SUMX ( 'ARRET', MINUTE ( ARRET[Sure] ) ) VAR Hours1 = SUMX ( 'ARRET', HOUR ( ARRET[Sure] ) ) VAR Seconds2 = MOD ( Seconds1, 60 ) VAR Minutes2 = MOD ( TRUNC ( Seconds1 / 60 ) + Minutes1, 60 ) VAR Hours2 = Hours1 + TRUNC ( ( TRUNC ( Seconds1 / 60 ) + Minutes1 ) / 60 ) RETURN Hours2 & ":" & FORMAT ( Minutes2, "00" ) & ":" & FORMAT ( Seconds2, "00" )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 Replies
- IceyCommunity Support
Hi Anonymous ,
You can try to create a Measure like so:
Total Time = VAR Seconds1 = SUMX ( 'Table_', SECOND ( Table_[Time_] ) ) VAR Minutes1 = SUMX ( 'Table_', MINUTE ( Table_[Time_] ) ) VAR Hours1 = SUMX ( 'Table_', HOUR ( Table_[Time_] ) ) VAR Seconds2 = MOD ( Seconds1, 60 ) VAR Minutes2 = MOD ( TRUNC ( Seconds1 / 60 ) + Minutes1, 60 ) VAR Hours2 = Hours1 + TRUNC ( ( TRUNC ( Seconds1 / 60 ) + Minutes1 ) / 60 ) RETURN Hours2 & ":" & FORMAT ( Minutes2, "00" ) & ":" & FORMAT ( Seconds2, "00" )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Can you write the measur codes according to my column names? because I couldn't 😞
Table name: ARRET
Coulm name: Sure
Thank you
- IceyCommunity Support
Hi Anonymous ,
Sure, try this:
Total Time = VAR Seconds1 = SUMX ( 'ARRET', SECOND ( ARRET[Sure] ) ) VAR Minutes1 = SUMX ( 'ARRET', MINUTE ( ARRET[Sure] ) ) VAR Hours1 = SUMX ( 'ARRET', HOUR ( ARRET[Sure] ) ) VAR Seconds2 = MOD ( Seconds1, 60 ) VAR Minutes2 = MOD ( TRUNC ( Seconds1 / 60 ) + Minutes1, 60 ) VAR Hours2 = Hours1 + TRUNC ( ( TRUNC ( Seconds1 / 60 ) + Minutes1 ) / 60 ) RETURN Hours2 & ":" & FORMAT ( Minutes2, "00" ) & ":" & FORMAT ( Seconds2, "00" )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- amitchandakSuper User
What is the source.
You can use duration function in M, under power query /edit query
https://docs.microsoft.com/en-us/powerquery-m/duration-functions
- AnonymousNot applicable
Thank you for answer.
Report in direct query mode from SQL database. How should i do?