Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

update the value based on the status group by the year

Anastasio_Theohari
8 - Asteroid

Hello team,

I would like to update all the months that are in a specific status for each year..

 

lets say i have the below dataset: 

 

YYYYMM  Status

202101        1

202102        1

202103        1

202104        1

202105        1

202106        1

202107        0

202108        1

202109        1

202110        1

202111        1

202112        1

202201       1

202202        1            

 

if i found at least one status=0 in one month i would like to make all the others equal with 0..

 

So the result i would like to have is : 

YYYYMM  Status

202101        0

202102        0

202103        0

202104        0

202105        0

202106        0

202107        0

202108        0

202109        0

202110        0

202111        0

202112        0

202201        1

202202        1     

 

Any idea?

Thank you

3 REPLIES 3
binuacs
21 - Polaris

@Anastasio_Theohari One way of doing this

binuacs_0-1681218432979.png

 

Luke_C
17 - Castor
17 - Castor

Hi @Anastasio_Theohari 

 

Try this:

 

I parsed out the year, found the minimum value, then joined it back and used that as the status.

Luke_C_0-1681218476168.png

 

 

DataNath
17 - Castor
17 - Castor

Hey @Anastasio_Theohari is this only ever 0 and 1? Or can there be other statuses? Just in case, I've built out the following:

 

1) Parse the Year:

 

DataNath_0-1681218423158.png

 

2) Find the min value for each year:

 

DataNath_1-1681218439955.png

 

3) Join back to main dataset based on year:

 

DataNath_2-1681218454526.png

 

4) If the min_status is 0 then make the status 0, else leave it as is:

 

DataNath_3-1681218478194.png

 

If the statuses can only be 0 or 1 then you can simplify this by just using the min_status field as your new status field within the Join:

 

DataNath_4-1681218532982.png

Labels
Top Solution Authors