If you are reading it into a data table you can filter the data table down to unique distributor codes (example), then foreach distributor id in the list, filter your original data by the ID variable using the filter data table activity, and loop over the resulting lines. This would allow you to output your results and send the email at the end of processing each distributor.