Date differences within a table

Hi.

My Table has [USER], [VISIT], [DATE] column.

And [Visit] column has “Visit 1”, “Visit 2” values with it.
So it’s like

[USER] [VISIT] [DATE]
A Visit 1 2023-01-30
A Visit 2 2023-02-05
B Visit 1 2022-01-01
C Visit 1 2023-01-30
C Visit 2 2023-02-05

So, my goal is to have [USER], [VISIT], [DATE], [DIFF] columns,
and make [DIFF] columns to have (Visit 2’s Date - Visit 1’s Date) per ID
(Some of USER’s don’t have Visit 2 while having Visit 1)

I’ve been doing this with putting python script.
But I think it’s time to learn more about Knime.

I had a hunch that I may be able to accomplish this with GroupBy.
But… it seems like it’s not what I needed.

I think I can manage to handle this with long-way, but it won’t be more efficient than using python script in there.
And my best answer by myself so far, is using pivoting… but haven’t tried yet

So, I’m seeking for some wise advice/idea for this one.

Please enlighten me :slight_smile:
Thank you!

Yeah, Pivoting is the one I needed.

Sorry for alarm you folks.

Thanks.

1 Like

Not alarming at all. Thanks for posting your solution! :slight_smile:

1 Like

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