Forum Discussion
Anonymous
7 years agoNot applicable
Power Query - custom column - date -2 and another condition
Hi, I want to create a new column based on the condition that hortlistcount is 0 and Duedate is less than two days from now or overdue If so, it should say 1 else 0. So I made this: = Table...
- 7 years ago
You have to ask first for null in order to avoid the comparison between null and dates.
if [DueDate] = null then 0 else if [DueDate] <= Date.AddDays (DateTime.Date(DateTime.LocalNow()), -2) and [ShortListCount] = 0 then 1 else 0
Be carefull with quotes. If you type "1" the result will be a text 1 and not a number.
Regards,
Anonymous
7 years agoNot applicable
Ok, it shows error when duedate is null. That's logic :) But is it a way to handle that? show 0 if duedate is null
ibarrau
Super User
7 years agoHi, sure you can add and if [duedate] = null then ......... else [start the other condition]
You can decide if you want a value for this cases like 0 or 1 and add it there.
Regards,