Alteryx Designer Desktop Discussions

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

Max Ifs

ctheo
5 - Atom
I'm able to use "maxifs" in excel but I'm not sure how to replicate that in Alteryx. I need to be able to pull the largest value in a field if it matches the same Title and is from a prior period. 
 
I attached an excel file here. Would anyone be able to walk me through what tools would solve this?
7 REPLIES 7
DataNath
17 - Castor
17 - Castor

Hey @ctheo - here's my take on this:

 

1) Chuck a RecordID on for final sorting

2) Parse the dates into ISO format so we can use them for sorting in Alteryx (think sorting on the format you're already using should be fine but I always like to convert just to be safe)

3) Sort rows based on the date

4) Create a Multi-Row Formula to check whether [Amount] is larger than the [Expected] value in the row above

5) Use the previous [Amount] value if so, and the [Expected] value if not

6) Re-sort and clean up

 

Replicate Excel MAXIFS.png

Bren_Spill
12 - Quasar
12 - Quasar

@ctheo - see attached a similar approach to @DataNath using the multi row tool.

 

image.png

 

KGT
12 - Quasar

So you want the maximum of all rows before the current row for that title. Take a look at the attached. The Multi-row will get you your answer, but depending what you want to do with that answer, the top technique may help.

 

With the Multi-row, we only replace the answer if the answer on the previous row is larger than the amount. I left my first quick attempt there as well before I looked at the answer you were generating.

Qiu
21 - Polaris
21 - Polaris

Multi-row tool can do it very simply, nice ones.

I took a different an so well way though. ðŸ˜‚

0910-ctheo.png

Yoshiro_Fujimori
15 - Aurora
15 - Aurora

@ctheo 

 

I am not familiar with MaxIfs() of Excel, but I tried to follow the expected output.

I used Batch Macro as your expression seems to change the reference ranges at each row.

If you are not familiar with Macro, please check the Interactive Lessons for Macro.

https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Macros

I hope this helps.

 

Main Workflow

MaxIfs_main.png

Batch Macro

MaxIfs_macro.png

 

ctheo
5 - Atom

Thanks for your help!

ctheo
5 - Atom

Thanks for your help! I love the simplicity of the solution

Labels
Top Solution Authors