Take Prior Value per ID Field

Need a bit of help here, I can’t seem to figure out here to take the last non-missing value per ID for a specific column. See the screenshot, the “Temp” column is what I have, the “New Temp” column is what I want. Any idea how to do this?

KenM’s missing stuff.knwf (6.5 KB)

this doesn’t encapsulate the logic i don’t grok in the two rows following 39.05 (which seem like they should be 39.05 in New Temp but are, for some reason, not.)

That is because that is a new ID (i.e. a new person). I need the last value PER ID, so the in looking back it has to be per each unique ID.

ah i see. ya - then just add another static variable and another if and you should be set.

this can also be solved using the Missing Value node. It has an option “Previous Value” for imputation. But since you don’t want the last value of another ID to affect the values, you need to put it into a loop starting with a Group Loop Start that groups by ID. The loop body will then be executed once for each ID, filling in the last non-missing value where it can.
Kind regards


Thank you Alexander, that is exactly the answer I was looking for. I tried it, it works.


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