Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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?
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.
Try Date.AddDays(Date.From(DateTime.LocalNow()),60)
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
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 🙂
hmm I don't really get it. Perhaps I can't create the date range I want using M Query. Thanks anyway!
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/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
97 | |
80 | |
67 | |
63 |
User | Count |
---|---|
147 | |
110 | |
108 | |
85 | |
64 |