Last tested: Sep 18, 2018
Reference lines calculate based on the first column visible in a visualization in the returned dataset. So a max, min, average, or median will be based on the data in one column only, and not on every data point for that row.
You can do some table calculations to manipulate this behavior, but the exact functionality you'd want still might not be possible. (Ex: You want a stacked bar chart of pivoted data, so you make a table calc to horizontally total up values from each pivot for the sake of making the reference line work. However, now the total table calc will also show in he stacked bars.)
Here is the request to the product idea related.