The purpose of this function is to select the average interval between two dates per 'ACC_ID.' The set analysis is used to filter out ranges for two fields; 'PANEL_ID' and 'TEST_ID' as show per the '-='. However it's not working, I'm not sure if the syntax I used for the set analysis is not proper or... But, with this function in place and when I create a selection for panel id or test id within the ranges there is still data populating.