I tried to create a loop to collect the 50th percentile of many parameters using the following code, but both elements in "test_list" are the same (they are both 50% of weight). However, if I run the lines manually, it will work. Can I not use the Col Quantile() function in the for loop?
I tried to create a loop to collect the 50th percentile of many parameters using the following code, but both elements in "test_list" are the same (they are both 50% of weight). However, if I run the lines manually, it will work. Can I not use the Col Quantile() function in the for loop?
Yes, this is a bug. The developers have verified it is a caching issue with Col Quantile [& Col Median] specifically. The other Col functions do not have the issue. Using Substitute makes a new expression with each iteration of the loop so that caching does not get used improperly. Thanks for reporting this and I will file a bug report.
So, under the line, it's not Substitute, but the protection via Eval(Expr()) which fixes the bug.
nice example from @Arn_Cota [adapted version] illustrating the effect: