Forum Discussion
IF statement with date
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.
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.
- Anonymous7 years agoNot applicable
Managed to get the Hot or Cold working, however it's creating duplicate rows for some reason?
- edhans7 years agoCommunity Champion
The formula isn't creating extra rows. You have a merge that is causing that. I just tested it with random data and it works just fine. This just looks for dates in the previous 10 days. If so, it is Hot, otherwise Cold. I didn't bother changing future dates to show something different.
Please post a link to your model or a more complete set of data than screenshots to help with the merge issue.