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
ElliotP
Post Prodigy
Post Prodigy

Date Table, Powerquery to Future Set Date

Evening,

 

I've follow the guides to setup a Date Table using powerquery and it works perfectly.

 

let
    Source = #date(2010, 1, 1),
    Custom1 = List.Dates(Source, Number.From(DateTime.LocalNow())- Number.From(Source) ,#duration(1,0,0,0)),
    #"Converted to Table" = Table.FromList(Custom1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),

I was wondering how to change it from simply creating the DateTable "DateTime.LocalNow()" until today, but until say for example the 1/1/2018 instead.

 

Thoughts on the powerquery code?

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

Just replace DateTime.LocalNow() by #date(2018,1,1).

 

Alternative code:

 

let
    Source = Table.FromColumns({{Number.From(#date(2017,1,1))..Number.From(#date(2018,1,1))}}),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}})
in
    #"Changed Type"
Specializing in Power Query Formula Language (M)

View solution in original post

1 REPLY 1
MarcelBeug
Community Champion
Community Champion

Just replace DateTime.LocalNow() by #date(2018,1,1).

 

Alternative code:

 

let
    Source = Table.FromColumns({{Number.From(#date(2017,1,1))..Number.From(#date(2018,1,1))}}),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}})
in
    #"Changed Type"
Specializing in Power Query Formula Language (M)

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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