December 20, 2019
Hi, I wanted to create a table with a list of dynamic dates from 1st January 2019. My query formula is below but it has errors. Can you please correct them?
Source = #table( type table [Dates=date],{List.Dates(#date(2019, 1, 1), Duration.Days(DateTime.Date(DateTime.FixedLocalNow())-#date(2018,12,31)), #duration(1, 0, 0, 0))}),
Thanks a lot!
Vivian
July 24, 2019
Hi Vivian,
why are you not using
let
#"Start Date" = #date(2019, 1, 1),
Source = List.Dates(#"Start Date", Duration.Days(DateTime.Date(DateTime.FixedLocalNow())-#"Start Date")+1, #duration(1, 0, 0, 0)),
#"Calendar Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
#"Calendar Table"
best regards,
Guenter
Answers Post
July 24, 2019
you missed a bracket 🙂
Source = #table( type table [Dates=date],{{List.Dates(#date(2019, 1, 1), Duration.Days(DateTime.Date(DateTime.FixedLocalNow())-#date(2018,12,31)), #duration(1, 0, 0, 0))}}),
the function expects a single element (list) instead of already all dates (expanded list)
cheers,
Guenter
December 20, 2019
Hi Guenter
Thank you for your replies. Your formula in your above post 2 works and many thanks to you!
Re the amended formula in your post 3, it got rid of the orginal errors but the table does not generate the list of dates as I thought it would. Do you know why? I am very new to the M language...
Cheers,
Vivian
1 Guest(s)