# calculate 0 or 1 depending on the date

**URL:** <https://forum.knime.com/t/calculate-0-or-1-depending-on-the-date/45888>\
**Category:** KNIME Analytics Platform\
**Created:** [August 11, 2022, 9:54pm UTC](https://forum.knime.com/t/calculate-0-or-1-depending-on-the-date/45888 "2022-08-11T21:54:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jalvear](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@Jalvear](https://forum.knime.com/u/Jalvear)\
**Post date:** [August 11, 2022, 9:54pm UTC](https://forum.knime.com/t/calculate-0-or-1-depending-on-the-date/45888/1 "2022-08-11T21:54:34Z")

</div>

Hello, I really don’t know how to develop this exercise in python. I do it relatively easily, but here it has been difficult for me.

And it is that I have to create an array that contains 0 for those dates below the established date and one above and 0 values ​​it above the cancellation date if it exists

[result.xlsx](https://forum.knime.com/uploads/short-url/xxGmNp44cKVpjhnIs3ythnWpdS0.xlsx) (14.4 KB)

[exercise.xlsx](https://forum.knime.com/uploads/short-url/10uwRDJWfng6mYOzoiUeRgXOLur.xlsx) (14.4 KB)

I appreciate any help I really haven’t got anything useful

---

<div class="post-metadata">

**Author:** ![HansS](https://forum-cdn.knime.com/user_avatar/forum.knime.com/hanss/32/6979_2.png) [@HansS](https://forum.knime.com/u/HansS)\
**Post date:** [August 12, 2022, 6:55am UTC](https://forum.knime.com/t/calculate-0-or-1-depending-on-the-date/45888/2 "2022-08-12T06:55:06Z")

</div>

Hi @Jalvear

Since this is a KNIME forum, I have a possible solution for you in KNIME.  
[calculate\_0\_or\_1.knwf](https://forum.knime.com/uploads/short-url/bxOzGSflWyfYHU35YvL34xaOMmN.knwf) (34.7 KB)

 ![Schermafdruk van 2022-08-12 08-53-21](https://forum-cdn.knime.com/uploads/default/original/3X/0/0/004a95ac5c81223a673e048c4fc52100590d22dc.png)  
gr. Hans

---

<div class="post-metadata">

**Author:** ![Jalvear](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/j/ea5d25/32.png) [@Jalvear](https://forum.knime.com/u/Jalvear)\
**Post date:** [August 12, 2022, 2:23pm UTC](https://forum.knime.com/t/calculate-0-or-1-depending-on-the-date/45888/3 "2022-08-12T14:23:34Z")

</div>

Hello @HansS , thank you very much, it was what I was looking for, I appreciate your help, I did know that I had to make a loop but I did not find the way.

I only have one question, do you know any way to make this finish faster? Well, the sample that I pass you is relatively small compared to half a million data for what I have to do this, and the flow takes a couple of minutes

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [August 19, 2022, 2:24pm UTC](https://forum.knime.com/t/calculate-0-or-1-depending-on-the-date/45888/4 "2022-08-19T14:24:33Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
