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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
crjackson
Helper I
Helper I

Data Type - Duration

Hello!

I am working on a dashboard to show staff's time accruals. The hour format is shown below. When I try to convert it to duration, it shows errors. The report comes in Hrs:Min:Sec. Please help!

 

crjackson_0-1678916589077.png

 

2 REPLIES 2
artemus
Microsoft Employee
Microsoft Employee

The format for duration is Day.Hrs:Min:Sec where Day, Hrs,Min are integers, and Sec is a decimal.

 

Since Hrs is at or over 24 an error occurs, as that would be one day. Instead you will need to parse this manually using a function like:

(d as text) as duration => 
let 
   parts = List.Transform(Text.Split(d, ":"), Number.FromText),
   asDuration = #duration(Number.IntegerDivide(parts{0}, 24), Number.Mod(parts{0}, 24), parts{1}, parts{2})
in
   asDuration
Peter_Beck
Resolver II
Resolver II

Take a look at this problem, which may be the same as yours:

 

https://community.powerbi.com/t5/Power-Query/Duration-Conversion-and-Calculation/m-p/3132207#M100280

 

Basically, converting from a time or date won't work the way you want it to, so be sure that the data is not of that type. 

 

Hope this helps - 

 

Peter 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.