In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

How to count sequential groupings

ktberger_2020
7 - Meteor

Can someone please help me figure out how to count the number of times a unique entity has a sequential count? It does not matter how long any sequence is, as long as it is 2 or more.

In the example below, the desired result for Customer 33359 would be a count of 3 and for Customer 12345, the count would be 2. 

 
StoreCustomerPaymentRow
C0299333599
C02993335910
C02993335911
C02993335922
C02993335923
C02993335931
C02993335932
C02993335933
C02991234516
C02991234517
C02991234528
C02991234529
3 REPLIES 3
Carolyn
12 - Quasar
12 - Quasar

A Multi-Row formula should work for this. 

 

  1. I created a new column called "Sequential?" in the Multi-Row Tool.
  2. For the logic: if the Payment Row is 1 more than the Prior Row AND it's not 2 more than the 2-Prior Row, put 1. Otherwise put 0
    1. The "not 2 more" piece is so if you have 3 or more consecutive values, you get the 1 for the first set of consecutive values and then 0 after that, so you only count it once
  3. Summarize Tool to total up the "Sequential?" column

 

Note - I added a value for Customer 33359 with a row of 34 into your data to confirm it worked for 4 sequential numbers

 

2024-09-11_12-23-30.png

 

nagakavyasri
12 - Quasar

@ktberger_2020 another way:

 

Screenshot 2024-09-17 162331.png

ktberger_2020
7 - Meteor

The multi row formula worked perfectly. Thank you.

Labels
Top Solution Authors