calculate correct distinct values if they are not given by the selection