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
reacharihant
Regular Visitor

Converting seconds into day hours min sec

I need to convert seconds into day hours min sec. How can I do it? 

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

Preferably in Power Query. e.g.: 

 

let
    Source = #table(type table[Seconds = Int64.Type],{{4000},{40000},{100000},{1000000}}),
    Day    = Table.AddColumn(Source, "Day",   each            Number.IntegerDivide([Seconds],24*60*60),  Int64.Type),
    Hours  = Table.AddColumn(Day,    "Hours", each Number.Mod(Number.IntegerDivide([Seconds],60*60),24), Int64.Type),
    Min    = Table.AddColumn(Hours,  "Min",   each Number.Mod(Number.IntegerDivide([Seconds],60),60),    Int64.Type),
    Sec    = Table.AddColumn(Min,    "Sec",   each Number.Mod([Seconds],60),                             Int64.Type)
in
    Sec

 

or otherwise in DAX:

 

DAXDay   =     INT(Query1[Seconds]/(24*60*60))
DAXHours = MOD(INT(Query1[Seconds]/(60*60)),24)
DAXMin   = MOD(INT(Query1[Seconds]/60),60)
DAXSec   = MOD(    Query1[Seconds],60)

 

Specializing in Power Query Formula Language (M)

View solution in original post

2 REPLIES 2
MarcelBeug
Community Champion
Community Champion

Preferably in Power Query. e.g.: 

 

let
    Source = #table(type table[Seconds = Int64.Type],{{4000},{40000},{100000},{1000000}}),
    Day    = Table.AddColumn(Source, "Day",   each            Number.IntegerDivide([Seconds],24*60*60),  Int64.Type),
    Hours  = Table.AddColumn(Day,    "Hours", each Number.Mod(Number.IntegerDivide([Seconds],60*60),24), Int64.Type),
    Min    = Table.AddColumn(Hours,  "Min",   each Number.Mod(Number.IntegerDivide([Seconds],60),60),    Int64.Type),
    Sec    = Table.AddColumn(Min,    "Sec",   each Number.Mod([Seconds],60),                             Int64.Type)
in
    Sec

 

or otherwise in DAX:

 

DAXDay   =     INT(Query1[Seconds]/(24*60*60))
DAXHours = MOD(INT(Query1[Seconds]/(60*60)),24)
DAXMin   = MOD(INT(Query1[Seconds]/60),60)
DAXSec   = MOD(    Query1[Seconds],60)

 

Specializing in Power Query Formula Language (M)

Thanks! Got it.

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