I need to calculate the period in which it changes from 1 to 0 or 0 to 1for multiple months

hello I am trying to calculate the variations in the states of a person I know this by putting 1 when the client is active 0 when he is inactive I need to identify in which period the client went from being inactive to being active and from active to inactive.

image THIS IS MY TABLE
This is the result I would like to get
image

Are the negative signs in your “result” screenshot necessary?

Hello @Jalvear ,

here is a workflow I have prepared.

Tell me if it works for you!

Have a nice day,
Raffaello

Hello @lelloba thank you very much for wanting to help me with my problem, your solution does what I need, however I think it is a good solution when you have a small number of clients, in my case I have more than 100,000 and the time it takes is quite a bit, even I keep running it to see how much the total is. Thank you very much for the help.

1 Like

@elsamuel It is not necessary, simply the negative identifies me that a client went from inactive to active

Glad it helped :slight_smile:
Later I can try to change it a little bit to make it more efficient.

Raffaello

Is it slow because of the loop
You could try unpivoting with rule engine

I borrowed @lelloba work (thanks for that appreciate it!)

br

3 Likes

I have updated my workflow too :slight_smile: See the previous link

Have a nice evening,
Raffaello

2 Likes

@Daniel_Weikert @lelloba

Hello, thank you very much for the solutions, very elegant by the way, I appreciate you taking the time to help me and teach me a new way of doing it. It is all I needed now if I can continue, I reiterate again thank you both very much for such good solutions.

Best regards

2 Likes