Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

How can I add another row to a Multi-Row Expression?

hellyars
13 - Pulsar

I need a little help modifying an expression

 

Current Scenario

I have a data set that includes Name and cost type (CT) and amount for a given year (2017 $).  

For any cost type Bs, I need to add B to A.  (B is always negative.)  I use the following expression with the Multi-Row Tool set to create new field. 

 

if [Row+1:CT] = 'B' then [2017 $] + [Row+1:2017 $] else [2017 $] endif 

 

NameCT2017 $
JeepA555
G-WagonA1800
G-WagonB-100
G-WagonC200
HMMWVA800
HWMMVB-400
UnimogA700

 

Question

 

Now I need to add E to the expression.  Like B, E is always negative.  But, its still A+B+E.  

How do I mod the expression to include E?

 

NameCT2017 $
JeepA555
G-WagonA1800
G-WagonB-100
G-WagonE-500
G-WagonC200
HMMWVA800
HWMMVB-400
UnimogA700
   

 

2 REPLIES 2
hellyars
13 - Pulsar

Okay, I tried the following...

 

if [Row+1:CT] = 'B' then [2017 $] + [Row+1:2017 $]
elseif [Row+1:CT] ='B' and [Row+2:CT] ='E' then [2017 $] + [Row+1:2017 $] + [Row+2:2017 $]
else [2017 $]
endif

 

It does not work with the"if" and "else if" expressions work on their own, BUT they don't work together.  How do I do this? 

I need to account for scenarios where just As exist, A and Bs exist and A, B and Es exist.

hellyars
13 - Pulsar

I think I got it.  Hopefully it will translate to the real data/worklow.

 

if
[Row+1:CT] = 'B' and [Row+2:CT]!='E' then [2017 $] + [Row+1:2017 $]

elseif
[Row+1:CT] ='B' and [Row+2:CT] ='E' then [2017 $] + [Row+1:2017 $] + [Row+2:2017 $]
else [2017 $]
endif

Labels