Looking to see if there's a creative way to find the Nth smallest value in a time range using the default Analysis/PE expressions. Preference is not to develop a custom ACE calc or store each of the Nth smallest values as attributes if possible.

Looking to see if there's a creative way to find the Nth smallest value in a time range using the default Analysis/PE expressions. Preference is not to develop a custom ACE calc or store each of the Nth smallest values as attributes if possible.

- 1 person found this helpful
I agree that there is no good way to do this. Here is my clumsy attempt at finding the second lowest value using a binary search.

Find the lowest value, divide the time period into two halves, find the the lowest in the first, find the lowest and the second.

This will give you the second lowest (which might be the same value as the lowest, but occurring at a different time)

I haven't fully tested this, there will most probably be issues if the lowest value is the first value or such things.This doesn't answer the actual question of the third lowest though..

An other way of doing this, not using analysis, is to setup access to the PI Data Archive as a Linked Tabled using PI OLEDB. You can then write an SQL query to retrieve such information.

I don't think there is any built in PE/Analysis expression that will do what you are looking for. All of the examples I've seen of people doing similar things required some custom code.