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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Ah_saaah01
Helper I
Helper I

How to work with minutes and seconds with DAX

Hi please help, how to write the DAX formula to generate a list like the following running day number + 24 hours for the whole year (day 366), maybe includes seconds in every hours...

 

Day 1, 0:00

Day 1, 1:00

Day 1, 2:00

.....

Day 1, 23:00

Day 2, 0:00

Day 2, 1:00

...

Day 366, 23:00

 

Thank you for any tips:) 

1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

I would usually do this in the query editor with M, but here is one way to do it with DAX.

DateHour =
ADDCOLUMNS (
    ADDCOLUMNS (
        GENERATESERIES ( 0, 365 * 24, 1 ),
        "DateTime",
            DATE ( 2023, 1, 1 )
                + ROUNDDOWN ( [Value] / 24, 0 )
                + TIME ( [Value], 0, 0 )
    ),
    "Day", DAY ( [DateTime] ),
    "DayHr",
        "Day " & DAY ( [DateTime] ) & ", "
            & HOUR ( [DateTime] ) & " hr"
)

ppm1_0-1676380671138.png

 

Pat

Microsoft Employee

View solution in original post

2 REPLIES 2
Ah_saaah01
Helper I
Helper I

Thank you Pat:) Would be nice to know the same in M too, if you have time.

ppm1
Solution Sage
Solution Sage

I would usually do this in the query editor with M, but here is one way to do it with DAX.

DateHour =
ADDCOLUMNS (
    ADDCOLUMNS (
        GENERATESERIES ( 0, 365 * 24, 1 ),
        "DateTime",
            DATE ( 2023, 1, 1 )
                + ROUNDDOWN ( [Value] / 24, 0 )
                + TIME ( [Value], 0, 0 )
    ),
    "Day", DAY ( [DateTime] ),
    "DayHr",
        "Day " & DAY ( [DateTime] ) & ", "
            & HOUR ( [DateTime] ) & " hr"
)

ppm1_0-1676380671138.png

 

Pat

Microsoft Employee

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 Kudoed Authors