Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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:)
Solved! Go to Solution.
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"
)
Pat
Thank you Pat:) Would be nice to know the same in M too, if you have time.
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"
)
Pat
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.