Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Multi row calculation help

Rag1
6 - Meteoroid

Here is my data

 
IDRANKINGDOMAIN
X1support
X2agent request
Y1unknown
Y2unknown
Y3agent request
Y4support
Z1unknown
Z2unknown

 

I am trying to get first ranked domain for each ID.( for ID 'X ' the DOMAIN value should be 'support') 

And if there is 'unknown' then give me the first unknown value in the sequence.(for ID 'Y' the DOMAIN value should be 'agent request')

And if all the Domain values are unknown then give me unknown(for ID 'Z' the Domain value should be 'unknown')

 

The final table should look like this

 

IDNEW DOMAIN
Xsupport
Yagent request
Zunknown

  

Thanks a lot for looking into this, hopefully someone can guide me.

3 REPLIES 3
Luke_C
17 - Castor
17 - Castor

hi @Rag1 

 

Here's how I'd approach:

  1. Sort, filter out unknowns, and sample the first value for each ID. This handles the first two conditions you listed.
  2. Then, compare the IDs we sampled to the overall list of IDs. For any that don't match up make those values unknown

image.png

Rag1
6 - Meteoroid

Thanks Luke, it worked perfectly!

flying008
15 - Aurora

Hi, @Rag1 

 

FYI.

Spoiler
IF [DOMAIN] = Trim(Replace(PadRight('', [RANKING], '|'), '|', 'unknown,'), ',') 
THEN 'unknown' 
ELSEIF StartsWith([DOMAIN], 'unknown') 
THEN Left(Replace([DOMAIN], 'unknown,', ''), FindString(Replace([DOMAIN], 'unknown,', ''), ','))
ELSE Left([DOMAIN], FindString([DOMAIN], ','))
ENDIF

 

录制_2024_11_07_09_28_18_767.gif

Labels