Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Multi Row Formula Group ID

PeterAP
8 - Asteroid

I've created a multi-row formula having grouped by 2 fields and then using the following expression.

 

IF DateTimeDiff([Doc Date],[Row-1:Doc Date],'days')<=1
THEN "Yes"
ELSEIF DateTimeDiff([Doc Date],[Row+1:Doc Date],'days')>=-1
THEN "Yes"
ELSE ""
ENDIF

 

What I want to be able to do is give them a group ID based on whether or not they form part of the same group where a record is within one day of each other.

 

For example, the current result in the below is "Yes" and that matches the criteria, however, I want to group them relative to the others hits i.e. the 3rd row below is not within 1 day of the 2nd row and therefore a new group (e.g. "Yes2" should be given to it.

 

Field 1Field 2DateCurrent ResultDesired Result
AB30/06/2020YesYes1
AB01/07/2020YesYes1
AB07/07/2020YesYes2
AB07/07/2020YesYes2

 

Is anyone able to help me with this?

 

Thanks

3 REPLIES 3
fmvizcaino
17 - Castor
17 - Castor

Hi @PeterAP ,

 

I can help you building the expression but I need to understand if something like below happens:

 

Field 1Field 2DateCurrent ResultDesired Result
AB30/06/2020YesYes1
AB01/07/2020YesYes1
AB07/07/2020YesYes2
AB07/07/2020YesYes2
AB08/07/2020YesYes2
AB09/07/2020Yes 

 

08/07 is within the second group, but what about the next date and so on? 

 

Best,

Fernando Vizcaino

seven
12 - Quasar

Hi,

 

try this and let me know how it goes.

seven_0-1597254684652.png

 

seven_0-1597256724754.png

 

PeterAP
8 - Asteroid

Thanks @seven,

 

That worked perfectly.

 

I used a filter from my original multi field formula to extract only those which met my criteria first and then used the multi-field formula you sent to group these.

Labels
Top Solution Authors