there's not much you can do about that then if that number is separated by other records. you would need to actually change the sort of your details to eliminate duplicates. i.e. sort first by transaction number as opposed to item number.
you're very limited in options in this format but one other option is to create a set of formulas with an array which takes in the transaction number. a suppression formula would be based on whether or not that transaction number was already in the array. you would have to then reset the array on every invoice.