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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Date-table: How to add 24 datetimes per day

Hi,

 

I have created a date-table in DAX based on following function: Date = CALENDAR(DATE(2012;1;1) ; (DATE(2020;12;31)))

 

I need to create a DATETIME column with all hours from 00.00 - 23.00 per date, i.e. 24 rows per date. The format should be "dd.mm.yy hh:mm:ss". Is there any formula to create such a column? If not, is there any method to create such a table in power query?

 

Thank you!

 

ExampleExample

2 ACCEPTED SOLUTIONS
donsvensen
Skilled Sharer
Skilled Sharer

Hi

 

You can create it like this in Power Query

 

let
    Source = List.Dates(#date(2018,3,25), 1, #duration(1,0,0,0)),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each {0..23}),
    #"Expanded {0}" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Added Custom1" = Table.AddColumn(#"Expanded {0}", "DateTime", each DateTime.From([Date])+#duration(0,[Custom],0,0))
in
    #"Added Custom1"

 

Modify the first step to create a longer period.

 

BR

 

/Erik

View solution in original post

v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

Based on my test, we can take the following steps to meet your requirement.

 

1. Enter a time table from 0:00:00-23:00:00.

 

2.Create the table using the formula as below.

 

DateTime = 
ADDCOLUMNS (
    CROSSJOIN (
        CALENDAR ( DATE ( 2012, 1, 1 ), DATE ( 2020, 12, 31 ) ),
       'Time'  
    ),
    "DateTime", [Date] + [Time]
)

3. Then we can get the result as we need.

 

Capture.PNG

 

For more details, please check the pbix as attached.

 

https://www.dropbox.com/s/8z0il9k8vy8l588/time.pbix?dl=0

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

Based on my test, we can take the following steps to meet your requirement.

 

1. Enter a time table from 0:00:00-23:00:00.

 

2.Create the table using the formula as below.

 

DateTime = 
ADDCOLUMNS (
    CROSSJOIN (
        CALENDAR ( DATE ( 2012, 1, 1 ), DATE ( 2020, 12, 31 ) ),
       'Time'  
    ),
    "DateTime", [Date] + [Time]
)

3. Then we can get the result as we need.

 

Capture.PNG

 

For more details, please check the pbix as attached.

 

https://www.dropbox.com/s/8z0il9k8vy8l588/time.pbix?dl=0

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
donsvensen
Skilled Sharer
Skilled Sharer

Hi

 

You can create it like this in Power Query

 

let
    Source = List.Dates(#date(2018,3,25), 1, #duration(1,0,0,0)),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each {0..23}),
    #"Expanded {0}" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Added Custom1" = Table.AddColumn(#"Expanded {0}", "DateTime", each DateTime.From([Date])+#duration(0,[Custom],0,0))
in
    #"Added Custom1"

 

Modify the first step to create a longer period.

 

BR

 

/Erik

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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