Forum Discussion
Converting decimals to MM:SS
Hi,
I'm completely stumpted and fustrated as to how I can achive this!
i'm trying to find out the average call waiting time, I have achieve this part... however the results are coming back as a decimal not and the time format how do I convert this back to time.
Thanks for any help!
Thanks for reaching out to us.
please try this solution, Solved: How to convert decimal to mm:ss in a Measure - Microsoft Power BI Community
test 3 = // Duration formatting // * Given a number of seconds, returns a format of "hh:mm:ss" // // We start with a duration in number of minutes VAR Duration = [A] // Minutes is the integer part VAR Minutes = INT ( [A] ) // Remaining seconds are the decimal remainder of the minutes times 60 after subtracting out the minutes VAR Seconds = ROUNDUP( ([A] - Minutes ) * 60 ,0) // We round up here to get a whole number // Minutes with leading zeros VAR M = IF ( LEN ( Minutes ) = 1, CONCATENATE ( "0", Minutes ), CONCATENATE ( "", Minutes ) ) // Seconds with leading zeros VAR S = IF ( LEN ( Seconds ) = 1, CONCATENATE ( "0", Seconds ), CONCATENATE ( "", Seconds ) ) // Now return minutes and seconds with leading zeros in the proper format "mm:ss" RETURN IF(Duration>0, CONCATENATE ( M, CONCATENATE ( ":", S ) ) , "00:00")Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- v-xiaotangCommunity Support
Thanks for reaching out to us.
please try this solution, Solved: How to convert decimal to mm:ss in a Measure - Microsoft Power BI Community
test 3 = // Duration formatting // * Given a number of seconds, returns a format of "hh:mm:ss" // // We start with a duration in number of minutes VAR Duration = [A] // Minutes is the integer part VAR Minutes = INT ( [A] ) // Remaining seconds are the decimal remainder of the minutes times 60 after subtracting out the minutes VAR Seconds = ROUNDUP( ([A] - Minutes ) * 60 ,0) // We round up here to get a whole number // Minutes with leading zeros VAR M = IF ( LEN ( Minutes ) = 1, CONCATENATE ( "0", Minutes ), CONCATENATE ( "", Minutes ) ) // Seconds with leading zeros VAR S = IF ( LEN ( Seconds ) = 1, CONCATENATE ( "0", Seconds ), CONCATENATE ( "", Seconds ) ) // Now return minutes and seconds with leading zeros in the proper format "mm:ss" RETURN IF(Duration>0, CONCATENATE ( M, CONCATENATE ( ":", S ) ) , "00:00")Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
- amitchandakSuper User
Millzy_moo796 , of the Avg time in second then you can convert to time like
time(0,0,[Avg Wait Time 1])
or refer these
https://radacad.com/calculate-duration-in-days-hours-minutes-and-seconds-dynamically-in-power-bi-using-dax
https://social.technet.microsoft.com/wiki/contents/articles/33644.powerbi-aggregating-durationtime-in-dax.aspx