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

Percentile aggregation

Wangwn
7 - Meteor

Is there any Alteryx function that can recreate the following statement?

 

percentile(CAST(substr(value, 5) AS INT), array(0.0, 0.5, 0.99, 1.0))

5 REPLIES 5
jdunkerley79
ACE Emeritus
ACE Emeritus

You would need to do this in a couple of steps

 

First CAST(substr(value, 5) as INT): This can be done using a formula tool. You can specify the type of the output as an Int32 and then the expression:

ToNumber(SubString([Value], 5))

You can then use a summarize tool to calculate the percentiles.

 

Sample attached

Wangwn
7 - Meteor

Thank you!

Kate
7 - Meteor

Is it possible to use a field input to determine the percentile value that the summarise tool calculates instead of having this hard coded as 25% for example?

Thanks

jdunkerley79
ACE Emeritus
ACE Emeritus

You could wrap the Summarise tool into a batch macro and have it read in. It is easy enough to generate the needed XML for the tool. 

 

It might, however, be easier to go back to first principles.  Attached a quick sample computing from first principles

 

 

Kate
7 - Meteor

I thought that may be the case but very useful to have the macro..thank you! :)

Labels