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

Creating MoM, YoY and YTD calculations for multiple KPIs

BigDataGeek
8 - Asteroid

Hey All,

 

I'm new to Alteryx, especially with creating and aggregating data within it, so bare with me.

 

I've got an excel data set I'd like to develop MoM, YoY and YTD calculations for each row of data.

 

My goals:

 - Create these calculations for all KPI columns (median sale price, median listing price, etc)

- Add field for 'Prior Month', 'Prior Year Month' and 'YTD' that display the actual numbers from those field.

- Add fields for 'MoM', 'YoY, and 'YTD' as a percentage change. 

    - The data is either ZIP code level OR MSA level.  If no Zip, then its already aggregated to MSA

    - Same applies for Year, except we compare it to the prior year, same month and develop a percentage change. 

    - For YTD, its YTD average / YTD Average (given same months) of year prior.

 

I've attached the data in a workflow for review.  Again, I'm new to this all, but willing to work to understand it all if someone could help with some best practices in this area and how to.

 

Thanks!

 

I'm trying to avoid calculating these in Tableau to increase dashboard speeds. 

15 REPLIES 15
JoshKushner
12 - Quasar

Hi Shap,

 

In the future you'll want to export your workbook otherwise we can't see the data you're reading.

 

Export:

export.PNG

 

Without knowing your data set I can't be specific, but the general calculations you're looking for are below:

(I've used random sample data)

 

Sample Data:

input data.PNG

 

Mean Price (Sale, Listing, etc.):

Use the summarize tool

sum.PNGsum r.PNG

 

Prior Month:

Use the multi-row formula tool

multi row.PNG

multi row r.PNG

 

Prior Year Month:

Now this can get tricky. If your data is organized like the sample data set you can use the multi row formula tool referencing the price 12 months ago --> [Row-12:Price].

If not, it's more complicated (we don't know if there's one price or multiple prices per month. If so, will we take the min, mean, or max price. We'll need a separate formula(s) to determine the record ID. etc.)

 

yoy formula.PNG

 

YTD (Assuming mean price YTD):

Use the multi-row formula tool twice (one create record ID's, the other to take mean)

     Flow:

     ytd flow.PNG

     Increment Record ID's:

     increment record id.PNG

 

     Calculate YTD:

     ytd formula.PNG

 

MoM (%):

Once we collect prior month price this is easy. Use the formula tool.

     Flow:

     flow mom.PNG

     Formula:

     MoM formula.PNG

 

YoY (%):

     Flow:

     Yoy pct flow.PNG

     Formula:

     Yoy pct formula.PNG

 

     

YTD (%):

     Flow:

     ytd pct flow.PNG

     Formula:

     ytd pct formula.PNG

 

 

 

BigDataGeek
8 - Asteroid

Hey Josh!  

 

Wow I appreciate the information.  I went ahead and exported as you recommended, in case this changes some of the step you provided me.   

 

Thanks again for all of the info.  I'll review it first thing in the AM when I'm fresh eyed!

JoshKushner
12 - Quasar

The formulas covered in the first part will get you most of the way there. You have so many columns that all of them need to be processed with the transpose tool and cross tab tool.

(An essential part of transpose/cross tab is add a record ID tool right before so everything lines up at the end)

I've attached the modified workflow.

 

Flow:

Flow 1.PNGFlow 2.PNG

Results:

results.PNG

 

 

 

Transpose:

trans.PNG

 

 

Cross Tab:

cross.PNG

 

BigDataGeek
8 - Asteroid

Hey Josh,

 

This is probably the most comprehensive and helpful response in a forum I've ever received.  Both extremely helpful in learning new processes and will save my countless hours banging my head on the desk.  GREATLY appreciated.

 

I am not able to open the packaged workflow however.  Looks like I'm running version 10.6.8.17850 of Alteryx.  Is it possible for you to downscale and resave? 

 

Again, thank you very much for the detailed step by step. 

JoshKushner
12 - Quasar

Happy to help! 

Try this attachment. I followed the steps here to try and turn it into v10.5. Let me know if you need a prior version from that. (You might be able to adjust the version using it as well if it still doesn't work)

(attaching both a regular workbook and the extract just in case)

BigDataGeek
8 - Asteroid

The regular workbook opened, but not the extract.  Workbooks works fine.

 

Ok I'm going to dig into the provided workbook and then I'll try reduplicating the process using your instructions so I get a better understanding of how you did it.

 

Again, thank you!

jdunkerley79
ACE Emeritus
ACE Emeritus

I thought I would show a small adjustment to @JoshKushner workflow.

2017-11-02_08-10-43.jpg

The principles are exactly the same but it does each period in parallel. The required periods are defined in a text input:

2017-11-02_08-11-40.jpg

and the starting date is computed using a formula tool

2017-11-02_08-12-37.jpg

 

After this, the RefDate is joined back to data on Date to get RefValue. 

 

Only a minor change from the great work @JoshKushner did but felt worth sharing.

 

Workflow attached in 10.5 format

BigDataGeek
8 - Asteroid

@jdunkerley79 thanks for the Alt version.   So does this reduce run time and simplify the stream a bit?  Really looking forward to gaining more experience with alteryx.

jdunkerley79
ACE Emeritus
ACE Emeritus

I expect the performance to be similar. If anything it may be slightly slower as it will involve slightly more sorts than @JoshKushner

 

 

My reasoning for my tweaks is:

- doesn't require all months to present

- easier to add another period (e.g if you wanted quarter very small change)

- by having less tools easier to debug

 

That being said had missed a field on the join so had a bug. New version attached with it corrected.

 

Labels