Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
mclawler
Helper III
Helper III

Convert Text Time Duration

I reviewed various previous threads on this matter, but they all seemed to confuse me even further.  

 

When I import my Excel report it stores the data below as text, no matter what I format them to within Excel itself.  These show H:M:S. - as an example for Logged In it's showing 8 hours:55 minutes:48.197 seconds

 

Logged InOff QueueOn QueueIdle
    
    
 08:55:48.197 01:51:28.360 07:04:19.837 02:36:25.481

 

I am trying to visualize cards that will show Total Logged In time, Average Logged In time, etc. sliced by a date slicer.  But when I use the fields above within PowerBI, there's no SUM or AVG options just First/Last.  

 

Please advise how to convert these text fields, I assume a calculated column is in order.  Whenever I try to convert data type from text to decimal number it tells me it can't automatically convert.  I have lots of columns within this report that need this conversion generated.  

 

Thank you for your time and support!

1 ACCEPTED SOLUTION

Try reading through this chapter on all the duration functions: https://learn.microsoft.com/en-us/powerquery-m/duration-functions.

 

I think you'll want to convert to duration from text first. Then parse out your hours, minutes, seconds and either aggregate them separately or convert them all into the same unit and then aggregate. 

View solution in original post

6 REPLIES 6
CoreyP
Solution Sage
Solution Sage

Have you tried using the Duration functions in Power Query? 

I think I found it

mclawler_1-1695074379936.png

 

Even if I choose minutes though, and then it generates a decimal number.  Is there an easy way to convert that decimal number to display in the visual card something like 8:35 for 8 hours and 35 minutes?  It seems like this decimal is always going to give me a decimal type visual.  Which would work, but cosmetically the 8:35 would look better than 8.5x hours if that makes sense... 

Yeah, so you will need the data type to be in a number format so you can create your aggregation measures. But then you can do some calculations and dynamic format string to put it back into the HH:MM:SS text format you're looking for. 

I'm a rookie so bare with me 🙂  But I found the Duration Function within Power Query and it changed the data to a decimal number.  You can see the comparison here between a converted column and a non-converted column.  But what is this decimal telling me? A fraction/decimal of how many days/hours?  If I know the basis of the decimal I think I can then convert to hours/minutes/seconds?  

 

mclawler_0-1695073845429.png

 

 

Thank you so much already!! 

Try reading through this chapter on all the duration functions: https://learn.microsoft.com/en-us/powerquery-m/duration-functions.

 

I think you'll want to convert to duration from text first. Then parse out your hours, minutes, seconds and either aggregate them separately or convert them all into the same unit and then aggregate. 

That's perfect!!  Thank you, I think you've got me on the right track now.  Much appreciated! 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.