enter =SUBTOTAL(19,D2:D1) in the last cell of column d (for example, D11), and when you continue to enter the contract in the future, you can insert the line at any time before the 1th line.
set automatic filtering, utilities-custom-include-utilities.
the figure in p>D11 is the sum of all contract amounts including public works.