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
tobiasmcbride
Helper III
Helper III

Power Query today plus 2 years

Hi,

 

I have a Power Query which produces an expanded list of dates from the start and ed date columns in my table. One part is:

 

if EndDate = null then (Date.From ( DateTime.LocalNow() ) else EndDate

 

This means that the end date is effectively taken as today's date if nothing is given there. However, I want this to dynamically change to be today's date plus 2 years such that when I refresh the data it automatically updates this. This is so that I can look ahead to forecasting figures rather than taking a backward looking view.

 

Any ideas greatly appreciated!

6 REPLIES 6
VasTg
Memorable Member
Memorable Member

@tobiasmcbride 

 

Did you try Date.AddYears()?

 

See below.

image.png

 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

ok brill thanks. What if I wanted the date to be the maximum of a particular column (e.g. the maximum date in the end date field) rather than a 2 years fixed from each day going forward?

@tobiasmcbride 

 

You  need to user GROUP BY as below.

image.png

After that expand the Expansion column.

 

Then create a column as below.

image.png

 

Then delete the unnecessary columns.

 

If it hleps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

and what if that end date is in a different table?

for instance I see this here (https://stackoverflow.com/questions/50457881/how-to-find-the-most-current-date-from-a-column-in-powe...) but when I try it it only allows me to use columns in the table I then used with this custom function.

@tobiasmcbride 

 

You should look at creating this in DAX as a New Column instead of Power Query.

Connect on LinkedIn

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.

Top Solution Authors