Forum Discussion
KristofferAJ
Helper III
4 years agoIf Statement in powerquery
Hi
I need to tweek my datediff calculation to blank out when the results are negative, but I cant't seem to get it right
[START DATE]
[END DATE]
= IF ([END DATE - [START DATE]) >0
then
([END DATE - [START DATE])
Else
null
???
Hello KristofferAJ ,
Please try creating custom column as -if Duration.Days([EndDate]-[StartDate]) < 0 then null else Duration.Days([EndDate]-[StartDate])Please mark it answer if it solves your issue. Kudos are also appreciated.
2 Replies
- Shishir22
Solution Sage
Hello KristofferAJ ,
Please try creating custom column as -if Duration.Days([EndDate]-[StartDate]) < 0 then null else Duration.Days([EndDate]-[StartDate])Please mark it answer if it solves your issue. Kudos are also appreciated.
- Fowmy
Super User
KristofferAJ
Zero here is a duration, so try the following= if [End Data]-[Start Date] > #duration(0,0,0,0) then [End Data]-[Start Date] else null