Forum Discussion
IF statement with date
Do this in Power Query as a custom column. Look at the Date functions. The Date.IsInPreviousNYears() function in particular would seem to do exactly what you want.
Hi Edhans. Thanks for your quick response. I've just tried to add the query but it's not quite stacking up. Please see below.
Surely the files that were accessed the day before yesterday as per the query below, should be hot. As you can see in the screenshot there's a number of files that were accessed on 25th March. Maybe i'm not understanding it properly.
- edhans7 years agoCommunity Champion
Try this:
- Anonymous7 years agoNot applicableHi edhans unfortunately that didn't work.
It just says cold all the way down the list and for some reason I get loads of duplicate rows.
Thank you for your responses.- edhans7 years agoCommunity Champion
I'd need to see your data. It will work. DateIsInPreviousNDays() simply returns true or false. Your original formula was comparing a date to the result DateIsInPreviousDays() but since the latter returns true/false, it will never equal any date, so the If statement always returned the FALSE result.