Alteryx Designer Desktop Discussions

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

Replace Column data grouped by number based on most recent date

Nmassarone
8 - Asteroid

Hello, hoping someone could help with the following I've been messing around with this for a little while and cant seem to figure out a solution...

 

I have a list of accounts that I need to fill in the annual income based on the most recent date (if applicable). there a few rows of examples I have on my sheet I added a column (MSTR_ANN_INCOME) to try to get a single value for the asked & not answered and Not asked as those would need to be replaced as well.

 

For Examples Row 1 is the header column…

 

The 1st thing I would want to look for is if the group (of MSTR_NUM)  all have no then the annual income would be filled in with the number

 

Example Rows 2-4 – because 2 & 4 are NO it would fill in 2-4 with 50k – 100k

 

The 2nd thing I would want to look for is if there are 2 different MSTR_ANN_INCOME (besides the NO) that it picks the most recent date and fills in all with the most recent date Annual income.

 

Example Rows 5-7 because 6&7 have different annual incomes but row 6 has a more recent date rows 5-7 would be filled in with 25k – 50k

 

The 3rd thing I would want to look for is if there are no dates (NULL) then it would pick the highest amount and fill in with the highest.


Example Rows 19 – 21 because 20&21 are missing dates I would want it to take the 250k – 500k and fill in 19-20 with 250k – 500k

 

Rows 8-18 are additional data

 

Below is the starting chart

MSTR_NUMANNUAL_INC_DESCACCT_OPEN_DTNAF_or_BROKMSTR_ANN_INCOME
178439  1894NO
17843950K - 100K10/30/2017JV73750K - 100K
178439ASKED & REFUSED 93857NO
21958 2/18/20143312NO
2195825K - 50K6/19/2019H7019825K - 50K
2195850K - 100K4/9/2002209250K - 100K
84756 7/12/20184754NO
84756 5/20/20205816NO
8475625K - 50K7/23/2007963125K - 50K
84756ASKED & REFUSED7/26/20174090NO
84756NOT ASKED10/6/2015F54818NO
37372  16830NO
37372250K - 500K5/31/2019HV60705250K - 500K
37372500K+6/10/20195183387500K+
68673  445608NO
68673100K - 250K1/24/2020JA87640100K - 250K
68673ASKED & REFUSED 42376NO
94837 5/19/2008156868NO
94837100K - 250K 49464100K - 250K
94837250K - 500K 1768791250K - 500K

 

Below the last row (IDEAL COLUMN) is what i would want the results to be (the MSTR_ANN_INCOME row could be deleted)

MSTR_NUMANNUAL_INC_DESCACCT_OPEN_DTNAF_or_BROKMSTR_ANN_INCOMEIDEAL COLUMN
178439  1894NO50K - 100K
17843950K - 100K10/30/2017JV73750K - 100K50K - 100K
178439ASKED & REFUSED 93857NO50K - 100K
21958 2/18/20143312NO25K - 50K
2195825K - 50K6/19/2019H7019825K - 50K25K - 50K
2195850K - 100K4/9/2002209250K - 100K25K - 50K
84756 7/12/20184754NO25K - 50K
84756 5/20/20205816NO25K - 50K
8475625K - 50K7/23/2007963125K - 50K25K - 50K
84756ASKED & REFUSED7/26/20174090NO25K - 50K
84756NOT ASKED10/6/2015F54818NO25K - 50K
37372  16830NO500K+
37372250K - 500K5/31/2019HV60705250K - 500K500K+
37372500K+6/10/20195183387500K+500K+
68673  445608NO100K - 250K
68673100K - 250K1/24/2020JA87640100K - 250K100K - 250K
68673ASKED & REFUSED 42376NO100K - 250K
94837 5/19/2008156868NO250K - 500K
94837100K - 250K 49464100K - 250K250K - 500K
94837250K - 500K 1768791250K - 500K250K - 500K

 

Any help would be greatly appreciated.

 

thank you.

11 REPLIES 11
mceleavey
17 - Castor
17 - Castor

Hi @Nmassarone ,

 

This is somewhat convoluted but I think I've built the required logic.

I've attached the workflow and I get the correct results.

 

I hope this helps,

 

M.



Bulien

Qiu
20 - Arcturus
20 - Arcturus

@Nmassarone 

I also hope I get your logic correctly.

0210-Nmassarone.PNG

Nmassarone
8 - Asteroid

@mceleavey Thank you so much I've been spinning my head over this for hours.... just 1 quick thing the results for MSTR_NUM 21958 looks like its pulling the lowest day (furthest back date) where we would want to pull the most recent date. is there a way to just flip flop instead of pulling the furthest back date the most recent date then i think this would be 100 percent perfect for what i need.

 

For example below the IDEAL_COLUMN should have the ANNUAL_INC_DESC of the most recent date (6/19/2019) so the 25k - 50k would be in the ideal column for this.

 

Nmassarone_0-1644511121075.png

 

Again thank you so much for this i really appreciate your effort on this. if there is just something i can adjust in the workflow to pull most recent date instead of furthest back just let me know

 

thanks again

 

Nmassarone
8 - Asteroid

@mceleavey @Qiu  thank you both for the replies i put both into test to see and it seems like I'm definitely getting close to the final result I think there's just a few tweaks...

 

The date if there are multiple of the same MSTR_NUM with different ANN_INCOME_DESC if it could pull the most recent date i think @Qiu thank you i ran yours i think its doing the same thing where it might not always pull in the most recent date (the most recent date might not always have the highest annual income) it could be lower.

 

i attached a new table with additional information and rows to test if i could get in the most recent date if there are multiples. i think if this had that 1 tweak this would be perfect.

 

thank you both for the response and your time on it its really appreciated.

 

example starting table

MSTR_NUMANNUAL_INC_DESCACCT_OPEN_DTNAF_or_BROKMSTR_ANN_INCOME
178439  1894NO
17843950K - 100K10/30/2017JV73750K - 100K
178439ASKED & REFUSED 93857NO
21958 2/18/20143312NO
2195825K - 50K6/19/2019H7019825K - 50K
2195850K - 100K4/9/2002209250K - 100K
84756 7/12/20184754NO
84756 5/20/20205816NO
8475625K - 50K7/23/2007963125K - 50K
84756ASKED & REFUSED7/26/20174090NO
84756NOT ASKED10/6/2015F54818NO
37372  16830NO
37372250K - 500K5/31/2019HV60705250K - 500K
37372500K+6/10/20195183387500K+
68673  445608NO
68673100K - 250K1/24/2020JA87640100K - 250K
68673ASKED & REFUSED 42376NO
94837 5/19/2008156868NO
94837100K - 250K 49464100K - 250K
94837250K - 500K 1768791250K - 500K
444978 12/27/2013354298NO
444978 10/18/20164123807NO
4449780 - 25K8/1/2014AC9600670 - 25K
444978100K - 250K5/7/1998205487100K - 250K
44497850K - 100K4/29/2020V08978050K - 100K
1148939 9/11/1997856359NO
114893950K - 100K1/17/2019JV79320850K - 100K
114893925K - 50K7/23/2021170866525K - 50K

 

 

 

Desired outcome table (as you can see MSTR_NUM 444978 the most recent date 4/29/2020 has an annual income of 50K - 100K which would be in the ideal column but isnt always the highest or lowest number then MSTR_NUM 1148939 i added as additional data as well.

MSTR_NUMANNUAL_INC_DESCACCT_OPEN_DTNAF_or_BROKMSTR_ANN_INCOMEIDEAL_COLUMN
178439  1894NO50K - 100K
17843950K - 100K10/30/2017JV73750K - 100K50K - 100K
178439ASKED & REFUSED 93857NO50K - 100K
21958 2/18/20143312NO25K - 50K
2195825K - 50K6/19/2019H7019825K - 50K25K - 50K
2195850K - 100K4/9/2002209250K - 100K25K - 50K
84756 7/12/20184754NO25K - 50K
84756 5/20/20205816NO25K - 50K
8475625K - 50K7/23/2007963125K - 50K25K - 50K
84756ASKED & REFUSED7/26/20174090NO25K - 50K
84756NOT ASKED10/6/2015F54818NO25K - 50K
37372  16830NO500K+
37372250K - 500K5/31/2019HV60705250K - 500K500K+
37372500K+6/10/20195183387500K+500K+
68673  445608NO100K - 250K
68673100K - 250K1/24/2020JA87640100K - 250K100K - 250K
68673ASKED & REFUSED 42376NO100K - 250K
94837 5/19/2008156868NO250K - 500K
94837100K - 250K 49464100K - 250K250K - 500K
94837250K - 500K 1768791250K - 500K250K - 500K
444978 12/27/2013354298NO50K - 100K
444978 10/18/20164123807NO50K - 100K
4449780 - 25K8/1/2014AC9600670 - 25K50K - 100K
444978100K - 250K5/7/1998205487100K - 250K50K - 100K
44497850K - 100K4/29/2020V08978050K - 100K50K - 100K
1148939 9/11/1997856359NO25K - 50K
114893950K - 100K1/17/2019JV79320850K - 100K25K - 50K
114893925K - 50K7/23/2021170866525K - 50K25K - 50K

 

 

thank you again for both your help appreciate it.

mceleavey
17 - Castor
17 - Castor

Hi @Nmassarone ,

 

are you sure you were looking at mine?

I just ran it again and I get this:

 

mceleavey_0-1644517559925.png

This is the most recent value.

M.

 



Bulien

Nmassarone
8 - Asteroid

Hi @mceleavey that's so weird so when i run it with the original table it seems to kick out with the 25k-50k but when i load in the other table that i had in the follow up (posted below) it kicks out with 50k-100k .... i guess another thing to note as well too when i load the workflow it says it was created with a newer version of Alteryx i seem to have an older version and i do get these warnings when running it not sure if that has something to do with it.

 

are you able to use the below table to see if you get the same results you have been getting?

 

this is the warning i get

Nmassarone_0-1644519247986.png

 

When i run the original i do get 25k-50k

Nmassarone_1-1644519344583.png

 

but when i run my actual sheet and this secondary sheet it comes out with the 50k-100k

Nmassarone_2-1644519402792.png

 

i tried switching around the date on my secondary sheet because i noticed my dates started out as YYYY-MM-DD so i converted them to MM/DD/YYYY but seem to still be getting the same results im not sure what is throwing this off.

 

are you able to use this secondary sheet and see if you still get the same results on your workflow maybe im just messing something up on mine

Secondary Sheet

MSTR_NUMANNUAL_INC_DESCACCT_OPEN_DTNAF_or_BROKMSTR_ANN_INCOME
178439  1894NO
17843950K - 100K10/30/2017JV73750K - 100K
178439ASKED & REFUSED 93857NO
21958 2/18/20143312NO
2195825K - 50K6/19/2019H7019825K - 50K
2195850K - 100K4/9/2002209250K - 100K
84756 7/12/20184754NO
84756 5/20/20205816NO
8475625K - 50K7/23/2007963125K - 50K
84756ASKED & REFUSED7/26/20174090NO
84756NOT ASKED10/6/2015F54818NO
37372  16830NO
37372250K - 500K5/31/2019HV60705250K - 500K
37372500K+6/10/20195183387500K+
68673  445608NO
68673100K - 250K1/24/2020JA87640100K - 250K
68673ASKED & REFUSED 42376NO
94837 5/19/2008156868NO
94837100K - 250K 49464100K - 250K
94837250K - 500K 1768791250K - 500K
444978 12/27/2013354298NO
444978 10/18/20164123807NO
4449780 - 25K8/1/2014AC9600670 - 25K
444978100K - 250K5/7/1998205487100K - 250K
44497850K - 100K4/29/2020V08978050K - 100K
1148939 9/11/1997856359NO
114893950K - 100K1/17/2019JV79320850K - 100K
114893925K - 50K7/23/2021170866525K - 50K

 

 

When i load the secondary sheet into Alteryx it loads in with YYYY-MM-DD 

 

this is the Input tool sheet

Nmassarone_3-1644519575357.png

 

 

Thank you

mceleavey
17 - Castor
17 - Castor

Hi @Nmassarone ,

 

I get the same as before:

 

mceleavey_0-1644520416974.png

 

No problems at my end, it seems you might need to upgrade your version of Alteryx.

 

M.

 



Bulien

Nmassarone
8 - Asteroid

ok yeah i think that might be my issue then because i get these warnings that it cannot convert 50k-100k to date/time which i think are the rows that are screwing up

 

unfortunately I'm on a company computer and cannot update to the latest version until the company gets the software so im stuck on 2020.4 for now.

 

Nmassarone_0-1644521565392.png

 

i will say the majority of my full list converted correctly its only a handful and i should be able to identify them so i really really appreciate you taking the time to go through this thank so much.

Nmassarone
8 - Asteroid

actually @mceleavey looking at your 2nd one see the very last group 1148939 ... the most recent date 7/23/2021 is annual income of 25k-50k but in the ideal column its showing 50k-100k

 

Nmassarone_1-1644522633644.png

 

thats what im a little confused on.

 

also the group 444978 the most recent date is 4/29/2020 which is 50k-100k but displays 100k - 250k in the ideal column 

Nmassarone_2-1644522794844.png

 

 

Labels