Power Query Rolling 12 Months Formula

charllie

Well-known Member
Joined
Apr 6, 2005
Messages
981
Hi All

Apologies if this has been raised previously but i have not found anything that does exactly what i want.

I am just discovering power queries and the wonderful things it can do for me.

I am currently creating a new power query and in the "Transform" stage. I have a column titled "Date Raised" and appears like "17/03/2021". I have now created a new custom column titled "Rolling Years". I want to inserts a formula in the "Custom Column Formula" section that does the following:

If "Date Raised" is greater than 12 months the text in the column titled "Rolling Years" = "Over 12 Months"
but
If "Date Raised" is lower than 12 months the text in the column titled "Rolling Years" = "Under 12 Months"

I have tried a few formula's but cannot get it to work.

I would appreciate any help in resolving this.

Thanks

Charllie
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

I_cant_read

New Member
Joined
May 17, 2015
Messages
25
Try the following in Add custom column.
It's on a year basis though.

=Duration.Days((Date.From(DateTime.LocalNow())-[Date Raised]))/365

Cheers
 

Watch MrExcel Video

Forum statistics

Threads
1,130,317
Messages
5,641,491
Members
417,212
Latest member
rsturbox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top