Start Free Trial

Alteryx Designer Desktop Discussions

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

For each row in a group, compare creation date with not outstanding date for all previous.

rebecca_w_s
5 - Atom

Hi.

I am looking at historic invoice data for different customers and I want to calculate for each invoice: “number of previous invoices still outstanding on creation”.

Thus, I have to compare the creation date of an invoice with the column “not outstanding date” (which I have created) for all previous invoices for that customer.

 

I also have some customers where multiple invoices are created on the same date.

 

I am assuming I need to create an iterative Macro?

 

Here is some example data:

CustomerInvoice Numberdate_creatednot_outstanding_date
customer1103.09.201508.09.2015
customer1206.09.201504.10.2015
customer1319.09.201509.10.2015
customer1424.09.201516.10.2015
customer2123.01.201709.02.2017
customer2210.02.201702.03.2017
customer2314.02.201706.03.2017
customer2428.02.201717.03.2017
customer2528.02.201717.03.2017

 

What I want to get:

CustomerInvoice Numberdate_creatednot_outstanding_datenum_outstanding_on_creation
customer1103.09.201508.09.20150
customer1206.09.201504.10.20151
customer1319.09.201509.10.20151
customer1424.09.201516.10.20152
customer2123.01.201709.02.20170
customer2210.02.201702.03.20170
customer2314.02.201706.03.20171
customer2428.02.201717.03.20172
customer2528.02.201717.03.20172

 

 

 

 

 

2 REPLIES 2
jdunkerley79
ACE Emeritus
ACE Emeritus

The easiest way I can think of is to join the data to itself on the Customer field

You can then filter where Invoice numbers are equal and the date_created being between the range of the second invoice

After that summarise to get the count. This will exclude ones with 0 matches so you need to add those back in.

 

2017-06-06_11-14-42.jpg

 

Sample attached

rebecca_w_s
5 - Atom

This works perfectly. Thank you.

Labels
Top Solution Authors