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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
eyelikedata2
Helper I
Helper I

How to extract day, hours, minutes and seconds from duration in separate columns for sum

Hello,

 

I have a data set with many rows of seconds listed as text for openDuration. I have created a custom column called timeDuration from or =#duration(0,0,0,[openDuration) to convert to proper format. However, I cannot use filter slicers in visuals like sum, avg, min and max from these. I read the solution was to separate the data and then add it back together again to filter on a single value.

 

Would anyone have any suggestions on how to go about this with a single column I can get values from?

 

Thank you!

 

 

7 REPLIES 7
eyelikedata2
Helper I
Helper I

bump

eyelikedata2
Helper I
Helper I

How would I do this?

 

I made the change to duration and it shows the data type correctly in transforms, but when looking in data mode, it becomes a decimal number. If I change it to time, it will result in numbers with E5 in them. Here's what I have now which does let me adust in the visual, but doesn't make any sense.

 

Capture1.PNG

 

Now in data view

 

Capture2.PNG

 

And the visual

 

Capture3.PNG

eyelikedata2
Helper I
Helper I

Here's a sample test data set.

 

The data

 

Capture1.PNG

 

The transform to add seconds was done in the prior image and last column to translate seconds of duration to a time format. I have left the default of text data type as changing to duration looks fine in transform mode.

 

Capture2.PNG

 

But again, when I attempt to use filters in a visual for min, max, average they are not present. I don't want a long answer but just to make this data visualize properly. I would prefer not to write out DAX or custom visuals, as this is easier to maintain for people who don't do this on a daily basis and need to understand or modify a visual.

 

Capture3.PNG

ppm1
Solution Sage
Solution Sage

Not totally clear on your scenario and separate columns. In general, it is a good practice to have a duration value as a decimal in days, load that, and then do your aggregate and then just display in hh:mm:ss with FORMAT.

Calculate and Format Durations in DAX – Hoosier BI

Pat

Microsoft Employee

@ppm1Hopefully, my response clarifies the ask. I need to be able to calculate the min, max and average from that dataset and column shown called timeDuration in the first and second images for the visual on the third.

In your query editor picture, the column still shows as ABC123 (the Any data type). Change that to duration. When you load it, it will show (like it does currently) as a decimal in days. That should show options for min/max/avg, but I would recommend writing explicit measures (MIN(table[timeDuration]) and using format strings or the FORMAT function like described in that article.

 

Pat

Microsoft Employee

@ppm1I did this as requested. The data view messes it up again.

 

Capture1.PNG

 

Capture2.PNG

 

But I can work with the data min, max, etc. but doesn't make sense.

 

Capture3.PNG

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors