Home > Mobile >  Complex row manipulation based on column value in SQL or Power Query
Complex row manipulation based on column value in SQL or Power Query

Time:05-14

I have a call dataset. Looks like this

enter image description here

If a call about a certain member comes in within 30 days of an "original call", that call is considered a callback. I need some logic or Power Query magic to handle this dataset using this logic. So the end result should look like this

enter image description here

Right now, I have the table left joined to itself which gives me every possible combination. I thought I could do something with that but it's proven difficult and when I have over 2 million unique case keys, the duplicates kill run time and overload memory. Any suggestions? I'd prefer to do the manipulation in Power Query editor but can do it in SQL. Plz and thank you.

CodePudding user response:

Think you can do this with Lead function.

here is the fiddle enter image description here

  • Related