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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
BishwaR
Helper V
Helper V

New Date Column

I need to create a new Product Expiration column in power query ( No Dax)

 

I have an existing Product Expiratioin column but besides that I need to create a new Product Epiration column where all the dates for next 90 days I need to replace one date which is today+90. For example if the existing Product Expiratiion has todays date then in the New Expiration column it has to be today's date+90. It has to replace the existing date with Today+90 for all the dates that fall within 3 months range then rest would be as it is.

 

Thanks

Bishwa

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Table.AddColumn (LastStepName, "Expiration Date", each if [DateColumn] >= Date.AddDays(Date.From(DateTime.LocalNow()), -90) then Date.AddDays(Date.From(DateTime.LocalNow()), +90) else [DateColumn])

 

--Nate

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

OK, if I understand correctly, for Expiration dates that are today through the next 90 days, use today+90 else use current Expiration date. If so, it's:

 

Table.AddColumn (LastStepName, "Expiration Date", each if [DateColumn] >= Date.From(DateTime.LocalNow()) and [DateColumn] <=  Date.AddDays(Date.From(DateTime.LocalNow()), + 90) then Date.AddDays(Date.From(DateTime.LocalNow()), +90) else [DateColumn])

Anonymous
Not applicable

You need just one parentheses at the end. 

Sorry I just realised it is changing the date for all the Expiration dates I just wanted to change the date for next 90 days only so how to write and && conditiion like   "Expiration Date", each if [DateColumn] >= Date.AddDays(Date.From(DateTime.LocalNow()), -90) &&  "Expiration Date", each if [DateColumn] <= Date.AddDays(Date.From(DateTime.LocalNow()), +90) then Date.AddDays(Date.From(DateTime.LocalNow()), +90) else [DateColumn]) then Date.AddDays(Date.From(DateTime.LocalNow()), +90) else [DateColumn])

so that all the dates after 90 days will fall under else condition

Anonymous
Not applicable

Table.AddColumn (LastStepName, "Expiration Date", each if [DateColumn] >= Date.AddDays(Date.From(DateTime.LocalNow()), -90) then Date.AddDays(Date.From(DateTime.LocalNow()), +90) else [DateColumn])

 

--Nate

image.png

I get this error. What did I miss ?

I figured out I missed a parenthesis Sorry !

Thanks for your help This is my solution Yeah

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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 Kudoed Authors