Skip to content
Advertisement

How to assign values to multiple columns using conditions for values from other multiple columns?

Dataset is something like this (there will be duplicate rows in the original):

enter image description here

Code:

JavaScript

Output should be this:

enter image description here

Code:

JavaScript

‘series1’ column values starts row by row as 0, 1, 2, and so on but resets to 0 when:

  1. ’email_ID’ column value changes.
  2. ‘screen’ column value == ‘rewardapp.PaymentFinalConfirmationActivity’

‘series2’ column values starts with 0 and increments by 1 whenever ‘series1’ resets.

My progress:

JavaScript

I think the code above is working, I’ll test answered codes and select the best in a few hours, thank you.

Advertisement

Answer

Let’s try

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement