Hi Loed,
I am not sure whether it work or not in your scenario.
Have a try below logic.
If data in your transcation number object contains only numeric then create one more infoobject and name it as Transcation Number ( Key Figure , Type Number ) and map earlier Transcation Number to this new Object in your transformation.
In your Bex , create formula by using this new trancation number object and in Exception aggregation select "last value" and ref charactestic "cal year / month"
Regards,
Anil