- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Duration Conversion and Calculation
I have incident time stamp column, attempted to convert to duration. It giving the "Expression.Error: We couldn't parse the Duration literal."
Searched and found in the community, it now returning "null" for those not having days in custom column. How to correctly format and then take average of this column to display in d:h:m:s ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Tevon713 ,
Here are the steps you can follow:
1. Create calculated column.
Convert Time to Second:
seconds =
var _day=VALUE(left('Table'[Incident Duratio:create-resolve],2))
var _hour=VALUE(MID('Table'[Incident Duratio:create-resolve],4,2))
var _minute=VALUE(MID('Table'[Incident Duratio:create-resolve],7,2))
var _second=VALUE(RIGHT('Table'[Incident Duratio:create-resolve],2))
return
_day * 24 * 60* 60
+
_hour * 60 * 60
+
_minute * 60
+
_second
average time:
Duration Average =
RIGHT ( "0" & INT ( AVERAGEA ( 'Table'[seconds] ) / ( 24 * 60 * 60 ) ), 2 ) & ":"
& RIGHT (
"0"
& INT (
(
AVERAGEA ( 'Table'[seconds] )
- INT ( AVERAGEA ( 'Table'[seconds] ) / ( 24 * 60 * 60 ) ) * ( 24 * 60 * 60 )
) / 3600
),
2
) & ":"
& RIGHT (
"0"
& INT (
(
AVERAGEA ( 'Table'[seconds] )
- INT ( AVERAGEA ( 'Table'[seconds] ) / 3600 ) * 3600
) / 60
),
2
) & ":"
& RIGHT (
"0"
& (
AVERAGEA ( 'Table'[seconds] )
- INT ( AVERAGEA ( 'Table'[seconds] ) / 60 ) * 60
),
2
)
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Tevon713 ,
Here are the steps you can follow:
1. Create calculated column.
Convert Time to Second:
seconds =
var _day=VALUE(left('Table'[Incident Duratio:create-resolve],2))
var _hour=VALUE(MID('Table'[Incident Duratio:create-resolve],4,2))
var _minute=VALUE(MID('Table'[Incident Duratio:create-resolve],7,2))
var _second=VALUE(RIGHT('Table'[Incident Duratio:create-resolve],2))
return
_day * 24 * 60* 60
+
_hour * 60 * 60
+
_minute * 60
+
_second
average time:
Duration Average =
RIGHT ( "0" & INT ( AVERAGEA ( 'Table'[seconds] ) / ( 24 * 60 * 60 ) ), 2 ) & ":"
& RIGHT (
"0"
& INT (
(
AVERAGEA ( 'Table'[seconds] )
- INT ( AVERAGEA ( 'Table'[seconds] ) / ( 24 * 60 * 60 ) ) * ( 24 * 60 * 60 )
) / 3600
),
2
) & ":"
& RIGHT (
"0"
& INT (
(
AVERAGEA ( 'Table'[seconds] )
- INT ( AVERAGEA ( 'Table'[seconds] ) / 3600 ) * 3600
) / 60
),
2
) & ":"
& RIGHT (
"0"
& (
AVERAGEA ( 'Table'[seconds] )
- INT ( AVERAGEA ( 'Table'[seconds] ) / 60 ) * 60
),
2
)
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank you @v-yangliu-msft.
I'm getting this error, tried converting column various format. Attached link to pbix here.
Another quick question: If I wanted to calculate the average of all numbers that belongs to a certain category. I'm thinking something along the line of the follow...
Average Number of Category=
Calculate('Table'[Duration Average],Filter(Table, 'Table'[ColumnName]="XYZ"))

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
03-14-2023 04:18 PM | |||
10-16-2019 09:25 AM | |||
09-01-2023 12:10 AM | |||
02-09-2025 01:18 PM | |||
Anonymous
| 01-29-2019 06:33 AM |
User | Count |
---|---|
85 | |
78 | |
41 | |
40 | |
35 |