Each of yoir documents is connected to a Department so you could use the below process of counting to produce a sequential numbering system stating at 1 for each Department. Once you have the document count number in your table you can add it into your text formula.