Alteryx Designer Desktop Discussions

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

Multirow Formula

UmarS
7 - Meteor

Hi All,

I am trying to solve the below use case. I need to set the target column to 0 if there exists any row with 0 for a particular Deal Name column. Otherwise set the target to the amount value. Thanks for your help.

 

DEAL_NAMEamountTarget
100
11500
12000
1150
200
300
31400
3500
43000
400
53030
53131
5 REPLIES 5
MarqueeCrew
20 - Arcturus
20 - Arcturus

@UmarS,

 

I'd go about this a different way.  You can take the incoming data through a SUMMARIZE tool and GroupBy Deal_Name with a MIN on amount.  Join that data back to the incoming data on Deal_Name.

 

Now you can create a formula with something like:

 

IIF([min_amount] == 0,0,[amount])

 

Then use a SELECT tool to remove the min_amount.

 

I think that it reads cleanly and is easy to maintain.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
DataNath
17 - Castor

How does this look @UmarS?

 

DataNath_0-1656086484191.png

 

UmarS
7 - Meteor

Thank you all. Yes it works with formula tool. However, it would be nice to make it work Multirow tool to save extra steps with formula/summarize/join tools.

DataNath
17 - Castor

@UmarS there’s no real truly dynamic/efficient way to do this without extending your multi-row formula massively in either direction and then writing a massive if statement, depending on how far the deal names can go in terms of # of rows. The solutions above are fully dynamic and still very simple - there may be other ways that I can’t think of off the top of my head, but I wouldn’t personally use a Multi-Row Formula for this problem.

oly
Alteryx Alumni (Retired)

@UmarS , for multi row not too hard but would probably need to sort ascending by the deal & amount. Otherwise only alternatives would be to take MIN() for multiple possible rows from min or max, that's probably what @DataNath referred earlier. 

See my solution attached with sorting, and if you need original records calculation you can add RecordID in the beginning and sort in the end again.

 

SUmmarize solution is rather universal and works great too.

Enjoy both solutions now!

Labels