Filtration of written off invoice

Filtration of written off invoice

I need to calculate total amount of payments received for all the bills which have been created in January 2017. Some of the bills which are created in January are partially paid in feb and march. some of the bills are written off as well.

How can i achieve that amount