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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
CarlsBerg999
Helper V
Helper V

Dynamic date table

Hi,

 

I'm having issues with my datetable in PQ. I'm trying to create a date table for 30 days in the past and 30 days to the future, calculated from today. For example today is 9.2021, so the Date table would be from 9.1.2021- 9.3.2021 (always 60 days).

 

My code is like this: 

 Source = Number.From(DateTime.LocalNow ())+ 30 - Number.From(#date(2020,01,01)),
#"Converted to Table" = List.Dates(#date(2020,01,01),Source,#duration(1,0,0,0)),

 

I can't seem to fix the start date. This will end up with 1.1.2020 to today +30 days. 

 

Any ideas?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

let
    start = Date.From(Date.AddDays(DateTime.FixedLocalNow(),-30)),
    dates=List.Dates(start,60,#duration(1,0,0,0))
in
    dates

View solution in original post

1 REPLY 1
Anonymous
Not applicable

let
    start = Date.From(Date.AddDays(DateTime.FixedLocalNow(),-30)),
    dates=List.Dates(start,60,#duration(1,0,0,0))
in
    dates

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.