Power Query - M | Create A Dynamic Date Table In Power Query

PHOTO EMBED

Thu Dec 07 2023 09:25:10 GMT+0000 (Coordinated Universal Time)

Saved by @nikahafiz #ms.pbi #power.query #date #earliest.date #ms.excel

Earliest Date

= #date(Date.Year(List.Min(Source[OrderDate])),1,1)

Latest Date

= #date(Date.Year(List.Max(Source[RequiredDate])),12,31)

(Dynamic) Calendar
let
    Source = {Number.From(pmEarliestDate)..Number.From(pmLatestDate)},
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}})
in
    #"Changed Type"
content_copyCOPY

https://www.ehansalytics.com/blog/2019/3/17/create-a-dynamic-date-table-in-power-query