Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

How to check the condition of multiple rows grouped by an ID

hal_dal
8 - Asteroid

Hi all,

 

Apologies if this question has already been asked but I couldn't find one that matched what I'm trying to achieve.

 

I basically have list of IDs and with these IDs I need to check several conditions and create a new column based on that.

Here's an example:

 

IDDate
ABC1/1/2020
ABC 
ABC1/1/2020
ABC1/1/2020
ABC1/1/2020
ABC1/1/2020
DEF1/1/2023
DEF1/1/2023
DEF11/11/2023
XYZY1/1/2020
XYZY11/11/2023
XYZY11/11/2023
XYZY11/11/2023

 

I have several IDs with different dates.

I want to check if each of the IDs have any null/blank value in the Date field and if yes, I want the new column to say "Null

If there's any dates that are in the future (e.g., the 2023 fields) then I want the new column to say "Future" 

And if all dates are in the past then I would like it to say "past"

 

If there's a mixture of Null, Past, Future then it should be Null, if Past and Future then it should be past

 

Here's the expected result:

 

 

IDDateNew Field-Check
ABC1/1/2020Null
ABC Null
ABC1/1/2020Null
ABC1/1/2020Null
ABC1/1/2020Null
ABC1/1/2020Null
DEF1/1/2023Future
DEF1/1/2023Future
DEF11/11/2023Future
XYZY1/1/2020Past
XYZY11/11/2023Past
XYZY11/11/2023Past
XYZY11/11/2023Past

 

 

I appreciate any help I could receive,

 

thank you!

 

7 REPLIES 7
IraWatt
17 - Castor
17 - Castor

hey @hal_dal 

I've attached an example workflow which does this, I think I captured your logic.

IraWatt_1-1650830513524.png

 

 

flying008
14 - Magnetar

Hi,@hal_dal 

 

for your information.

Input Output
IDDateIDDateCheck
ABC1/1/2020ABC1/1/2020 
ABC ABC  
ABC1/1/2020ABC1/1/2020 
ABC1/1/2020ABC1/1/2020 
ABC1/1/2020ABC1/1/2020 
ABC1/1/2020ABC1/1/2020 
DEF1/1/2023DEF1/1/2023Future
DEF1/1/2023DEF1/1/2023Future
DEF11/11/2023DEF11/11/2023Future
XYZY1/1/2020XYZY1/1/2020Past
XYZY11/11/2023XYZY11/11/2023Past
XYZY11/11/2023XYZY11/11/2023Past
XYZY11/11/2023XYZY11/11/2023Past

 

录制_2022_04_25_14_01_31_258.gif

flying008
14 - Magnetar

Hi,@hal_dal 

 

for your ref.

 

Input Output
IDDateIDDateCheck
ABC1/1/2020ABC1/1/2020 
ABC ABC  
ABC1/1/2020ABC1/1/2020 
ABC1/1/2020ABC1/1/2020 
ABC1/1/2020ABC1/1/2020 
ABC1/1/2020ABC1/1/2020 
DEF1/1/2023DEF1/1/2023Future
DEF1/1/2023DEF1/1/2023Future
DEF11/11/2023DEF11/11/2023Future
XYZY1/1/2020XYZY1/1/2020Past
XYZY11/11/2023XYZY11/11/2023Past
XYZY11/11/2023XYZY11/11/2023Past
XYZY11/11/2023XYZY11/11/2023Past

 

录制_2022_04_25_14_01_31_258.gif

binuacs
20 - Arcturus

@hal_dal Another way of doing this

binuacs_0-1650884521932.png

 

IraWatt
17 - Castor
17 - Castor

@binuacs,

Had a look through as it looks a lot simpler then mine :), not sure if it captures the logic of a ID having a "mixture of Null, Past, Future" then it should be Null?

hal_dal
8 - Asteroid

Thank you so much everyone for your help!
All answers definitely helped me get to where I needed to be for my final solution.

For the purpose of the example, I didnt provide an exact condition I needed but I definitely managed to alter the answers provided and make it work with what I need.

Thank you again!

IraWatt
17 - Castor
17 - Castor

No worries, awesome you get it working @hal_dal !

Labels