# How to Replace Invalid Birth Dates with Median Birth Dates?

**URL:** <https://forum.knime.com/t/how-to-replace-invalid-birth-dates-with-median-birth-dates/24694>\
**Category:** KNIME Analytics Platform\
**Created:** [June 19, 2020, 8:59am UTC](https://forum.knime.com/t/how-to-replace-invalid-birth-dates-with-median-birth-dates/24694 "2020-06-19T08:59:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dixonchan](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/cc9497/32.png) [@dixonchan](https://forum.knime.com/u/dixonchan)\
**Post date:** [June 19, 2020, 8:59am UTC](https://forum.knime.com/t/how-to-replace-invalid-birth-dates-with-median-birth-dates/24694/1 "2020-06-19T08:59:17Z")

</div>

Some rows contains invalid birth dates (e.g. born in 2029).

How do I write codes using the Column Expression node to replace invalid birth dates with the median birth date?

![Capture](https://forum-cdn.knime.com/uploads/default/original/3X/2/c/2cef2084603eaba55995850d3fe651c2554d555c.jpeg)

Below codes do not work.

```
var invalidBirthDate = new Date("2020-01-01")

if (column("Birthdate") > invalidBirthDate){
    median(column("Birthdate"))
}
```

---

<div class="post-metadata">

**Author:** ![andrejz](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@andrejz](https://forum.knime.com/u/andrejz)\
**Post date:** [June 19, 2020, 9:31am UTC](https://forum.knime.com/t/how-to-replace-invalid-birth-dates-with-median-birth-dates/24694/2 "2020-06-19T09:31:46Z")

</div>

Hi,

My suggestion is to replace the invalid birth dates with the median with “Rule engine” node. The median you can find with the “Groupby” node (and use it as variable).

---

<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:** [December 18, 2020, 9:33pm UTC](https://forum.knime.com/t/how-to-replace-invalid-birth-dates-with-median-birth-dates/24694/3 "2020-12-18T21:33:56Z")

</div>

Closed on December 18, 2020, 9:33pm UTC

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