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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

convert seconds column into duration column mm:ss

 
I tried the following DAX query, but its not given as a expected output
 
 
Mins : Sec =

 

VAR Duration = sum(TABLE1[seconds])

 

VAR Minutes =
INT ( MOD( Duration,3600 ) / 60)

 

VAR Seconds =
ROUNDUP(MOD ( MOD( Duration,3600 ), 60 ),0) // We round up here to get a whole number

 

// Minutes with leading zeros
VAR M =
IF (
LEN ( Minutes ) = 1,
CONCATENATE ( "0", Minutes ),
CONCATENATE ( "", Minutes )
)
// Seconds with leading zeros
VAR S =
IF (
LEN ( Seconds ) = 1,
CONCATENATE ( "0", Seconds ),
CONCATENATE ( "", Seconds )
)
// Now return minutes and seconds with leading zeros in the proper format "mm:ss"
RETURN
CONCATENATE ( M, CONCATENATE ( ":", S ) )
 
Following table i had.
 
 
Name   seconds   Mins:sec
Abi          500           18:05
Emi          250           18.05
 

Note  : Mins: sec column wrongly written as an expected output
 
 
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@konstantinos and I wrote an article this a long time ago, pluse I'm pretty sure there is something in the Quick Measure gallery for this:

 

https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486

https://community.powerbi.com/t5/Quick-Measures-Gallery/Seconds-2-HHMMSS/m-p/195615



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

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@konstantinos and I wrote an article this a long time ago, pluse I'm pretty sure there is something in the Quick Measure gallery for this:

 

https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486

https://community.powerbi.com/t5/Quick-Measures-Gallery/Seconds-2-HHMMSS/m-p/195615



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...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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