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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Add number of days to today's date m query

So I have the below formula which populates dates from 01/01/2018 (source) to today which I use as my dimension date table. 

I want to add 60 days to 'today' so it gives me two months ahead as well. 

 

= List.Dates(Source,Number.From(DateTime.LocalNow()) - Number.From(Source),#duration(1,0,0,0))

 Can you help?

8 REPLIES 8
jwhite
New Member

Hi @Anonymous ,

have you tried maybe - Date.AddDays(DateTime.Date(DateTime.LocalNow()),60)

It is very close to @jthomson , I use the top line in my calendar tables without any problems.

 

Hi!
I've use the next structure and it worked for me...
= List.Dates(
Source,
Number.From(Date.From(Date.AddDays(DateTime.LocalNow(),60)) - Date.From(Number.From(Source))),
#duration(1,0,0,0)
)

jthomson
Solution Sage
Solution Sage

Try Date.AddDays(Date.From(DateTime.LocalNow()),60)

Anonymous
Not applicable

That didnt work.

I tried it by itself and it had a probem with the numberof arguments, and I tried to combine it with my own query:

= List.Dates(Source,Date.AddDays(DateTime.LocalNow()) - Number.From(Source),#duration(1,0,0,0))

and that didn't work either.

By the looks of things you'd need to wrap that in Number.From the same way you did in your original line of code, that's intended to replace just the DateTime.LocalNow() section. Sticking what I posted into a blank query on its own gives 24/12/19 as expected

Anonymous
Not applicable

Thanks jt

 

I wanted to add days to a posting date column in a table - moving all dates x amount of days forward.  Created a new custom column in Power Query with the following formula as you suggested- works a treat.  (Remember to format the new column as Date :-)):

 

each Number.From([Date]) + 45

 

This post just FYI to someone a little stuck - Hope it helps 🙂

Anonymous
Not applicable

hmm I don't really get it. Perhaps I can't create the date range I want using M Query. Thanks anyway!

trebgatte
Most Valuable Professional
Most Valuable Professional

I documented how to do date arithmetic like what you need in our free Power BI Sherpa Guide. If you fill out the form here, it'll be emailed to you automatically. There's 43 pages worth of stuff you can use. https://forms.office.com/Pages/ResponsePage.aspx?id=SYqECQFL1UqcIq5nyd6FxCdp-KZ0zLhHp6AwOrTNardUNVJE...

 

Hope this helps!

--Treb

 

Check out my Power BI blog posts at https://marqueeinsights.com/tag/power-bi/ 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.