Forum

how do I show a dat...
 
Notifications
Clear all

how do I show a date a specified numbers of years ago in PQ

5 Posts
3 Users
0 Reactions
78 Views
(@agwalsh)
Posts: 100
Estimable Member
Topic starter
 

I can do this in Excel, no problem. However I want to do it in PQ. I have a list of renewal dates for subscriptions, I need to get the corresponding start dates but using the years'  duration of subscription...e.g. a renewal date is 31/1/2019, the number of years is 1, therefore I want PQ to show me the start date as 31/1/2018...have looked at the duration options but can't find anything there...

 
Posted : 07/08/2018 6:13 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Anne,

You can use Date.AddYears like so:

=Date.AddYears([Renewal Date],-[Years])

 

Mynda

 
Posted : 07/08/2018 7:22 am
(@agwalsh)
Posts: 100
Estimable Member
Topic starter
 

Brilliant - thanks a mil. Is it wrong to say I love you and want to have your Excel babies 🙂 in a MMMMM sort of way 🙂

 
Posted : 08/08/2018 4:13 am
(@khatikvasim13)
Posts: 24
Eminent Member
 

You can use

=DATE((YEAR(Renewal Date)-Years),MONTH(Renewal Date),DAY(Renewal Date))

 
Posted : 08/08/2018 4:42 am
(@mynda)
Posts: 4761
Member Admin
 

@Vasim, that is an Excel formula. Anne needed a Power Query formula, which is what I provided above.

@Anne, 😀

 
Posted : 08/08/2018 6:25 am
Share: