Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I'm building some fractile calculation into a tool, and while what I have currently works, it's not very fast. What I need is a function that essentially works as an inverse to a Pick function where there are a list of possible conditions, and it returns the place the first passing condition falls in.
The way I'm doing it currently is:
- Calculate all of the max values for each decile bucket:
vE_Decile_1_max = fractile($(vE_Decile_max_Calc),0.1)
vE_Decile_2_max = fractile($(vE_Decile_max_Calc),0.2)
vE_Decile_3_max = fractile($(vE_Decile_max_Calc),0.3)
etc.
Then running it through a big if statement:
if($(vE_PP_Total_Sales) <= $(vE_Decile_1_max), 1,
if($(vE_PP_Total_Sales) <= $(vE_Decile_2_max), 2,
if($(vE_PP_Total_Sales) <= $(vE_Decile_3_max), 3,
...
While this works, it's slow. I don't believe the class function will work either since the buckets aren't the same size.
Anyone have any ideas on how to speed this up?
Thanks!
Spencer
Hi Marco,
Petter's solution actually did the trick. Thanks for looking at this though!
Spencer
Yes this worked perfectly!
I hadn't considered reducing the the individual comparisons to boolean and summing up individual possibilities. Thanks for the help!