Forum Discussion
IF statement with date
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.
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.
- Anonymous7 years agoNot applicable
HI edhans, this is my data.
I'd like an additional column called 'hot' and then 'cold' and then 'Archive'. I think i'm struggling with the logic with PowerQuery. I've ordered a book that's arriving today so i can further learn it. I normally deal with PowerShell so dates are slightly different in that language.
This is so i can then add a visual to say Hot would be a certain price for data, COld would be another price, then Archive would be another price. Maybe this is easier with 3x columns (Hot, Cold, Archive)?
Thanks again.
edhans wrote: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.