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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Making sense of a column containing day.hours:minutes:seconds

Hi there,

 

So I have two datetime columns and I have calculated the difference between them using:

each Duration.ToText([end date]-[start date]), type number)

 

I have a column with values such as 

78.08:11:05 = 78 days, 8 hours, 11 minutes, 5 seconds

00.00:54 = 0 days, 0 hours, 0 minutes, 54 seconds

 

As a number, this is throwing up an error when I close and apply as I guess DAX doesn't like the format. 

 

I am going to need to be able to translate this column into a turnaround measurement. 

 

Can you suggest anything to stop this erroring when I get to Report View, and also be able to sum this and have it recognised as a period of time?

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

I believe you should be using Power Query's Duration data type instead of number.

 

Here is something that I wrote recently for dealing with Durations in DAX:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639?search-a...

 

In DAX it is more of a formatting thing since it does not have a true duration data type.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

amitchandak
Super User
Super User

In case both are DateTime. You should be able to use datediff. And if you can give diff in the required unit.

 

https://docs.microsoft.com/en-us/dax/datediff-function-dax

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

In case both are DateTime. You should be able to use datediff. And if you can give diff in the required unit.

 

https://docs.microsoft.com/en-us/dax/datediff-function-dax

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

I believe you should be using Power Query's Duration data type instead of number.

 

Here is something that I wrote recently for dealing with Durations in DAX:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639?search-a...

 

In DAX it is more of a formatting thing since it does not have a true duration data type.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks both, these both work, I prefer the dax though. Not sure why I forgot about this! 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors