Difference between two values of different measurements

Hi. Obviously I’m referring to Flux (we’re on an influxdb 2 forum).
If we were talking about a single table I would solve it this way: How to calculate difference between min and max with Flux?
The problem is that I want the difference between the maximum and minimum of 16 measurements.