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-Field Formula - Is this a use case?

JohnMaty
9 - Comet

HI All,

 

I have a table like below:

RptCategoryGrade2015201620172018
AGGRAVATED ASSAULTFelony16015318845
AGGRAVATED ASSAULT ON TEACHERFelony10810312331
ARSONFelony1924144
AUTO THEFT RELATEDFelony9516510927
AUTO THEFT RELATEDMisdemeanor101510 0

 

I am trying to do a % change year over year for each RptCategory.  Would I use the Multi-field tool?

I want to end up with something like this:

 

RptCategoryGrade2015-20162016-20172017-2018
AGGRAVATED ASSAULTFelony-4%23%-76%
AGGRAVATED ASSAULT ON TEACHERFelony-5%19%-75%
ARSONFelony26%-42%-71%
AUTO THEFT RELATEDFelony74%-34%-75%
AUTO THEFT RELATEDMisdemeanor50%-33%-100%

 

Keep in mind that this will need to adapt year over year.

Thanks in advance!

5 REPLIES 5
StephenR
Alteryx
Alteryx

The regular formula can create the new columns using the year over year information.  If you want it to update automatically, you may want to look into the Dynamic Formula in the CREW Macro Pack.  That might allow you to test for a new year column and automatically create the new field.

Regards,
Stephen Ruhl
Principal Customer Support Engineer

JohnMaty
9 - Comet

I have the CREW Macros and use them often but I have never used that one.  I am not sure how to use the normal formula to do this considering the column year will change.

MarqueeCrew
20 - Arcturus
20 - Arcturus

@JohnMaty,

 

I've solved your post with the use of 2 multi-row formulas.  One is used to calculate the delta and the other is to calculate the year header values.

 

capture.png

This is dynamic and will work for many years of data.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
BenMoss
ACE Emeritus
ACE Emeritus

Unfortunately I don't see you being able to use the multi-field formula too in this instance.

The idea of the multi-field formula tool is if you have a common denominator. I.e. if you wanted to do 2018 v 2017 and 2018 v 2016 and 2018 v 2015 for instance.

In order to achieve your goal in this instance I would do a transpose.

I would then use a multi-row formula tool to get your %'s before cross-tabbing back.

My % change calculation is slightly different to yours and based on the logic in this post (https://www.calculatorsoup.com/calculators/algebra/percent-difference-calculator.php), but I'm sure you can adjust that accordingly if you need.

See the attached solution.
Ben

BenMoss
ACE Emeritus
ACE Emeritus

Ha, same as @MarqueeCrew (Y)

Labels