Median Function in Celonis doesn't average middle numbers

The median function in the Celonis IBC appears to not work correctly when there is an even count of items in a data set. MEDIAN() appears to take the top middle number and display it instead of correctly calculating the average between the two middle numbers to get the true median of the data. Here is an example picture showing the difference between Celonis and Excel. Is there a fix for this or a way to calculate the true Median of a data set in Celonis when there is an even number of items?

Hi,

the MEDIAN PQL function takes the upper value of the two middle values if the number of values is even. This is on purpose and it is also described in the documentation. The reason for this is that the MEDIAN function can always return the same data type as the input. So if you have integers as an input, it always returns an integer.

Best
David

The added reason for always returning the same data type is what I was missing. Thank you for the clarification.