Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Multi-Row Standard Deviation?

Matthew
11 - Bolide

hello, i am writing a moving average using the multi-row tool like this:

Matthew_0-1685971449807.png


and i would like to also calculate a rolling standard deviation to match this moving average.. i imagined it looking something like this:

 

Matthew_1-1685971512459.png


But it looks like alteryx doesn't have a standard deviation function.... Can someone please help me figure out how to implement this?

4 REPLIES 4
OllieClarke
15 - Aurora
15 - Aurora

Hey @Matthew 

 

I wouldn't use the multi-row for this, but rather generate rows, join and summarise as here:

OllieClarke_0-1685972132622.png

You're basically using the generate rows to create a lookup matrix which you can use to join the relevant rows onto themselves. Then you can make use of all the aggregate functions in the summarise tool to do your moving calcs.

 

Hope that helps,

 

Ollie

 

Matthew
11 - Bolide


thanks for your suggestion @OllieClarke, but your solution would have been too computationally expensive. i'm working with over 80 million rows, so using the Generate Rows tool would have made the dataset balloon too much (i probably should have mentioned that)


but i think i got a solution working:

Matthew_0-1685974125077.png


I calculated the StdDev using the Multi-Row and Formula tool

Matthew_6-1685974570406.png

 


i started by getting the moving average

Matthew_2-1685974306917.png


then calculated the squared difference

Matthew_3-1685974352129.png

 

then got the sum of the squared difference

Matthew_4-1685974372423.png


then got the variance and StdDev from that

Matthew_5-1685974433703.png


i feel like alteryx should have a StdDev function, but i found a way around :)

OllieClarke
15 - Aurora
15 - Aurora

@Matthew Nice

 

With stats functions, there's always the option of doing it by hand 😂. I had a test, and breaking it down your way was 10x faster than the generate rows and join approach. I generally avoid writing multi-row formulas like yours, because they're very static (and annoying to write), but absolutely worth it in this case


Matthew
11 - Bolide

@OllieClarke  I feel the same way about the multi-row tool. It requires so much prep and cleaning to make it function properly, and modifying them is annoying. But this will work until there is a built in stdDev function

Thanks for doing the performance comparison!

Labels