I think you are complicating this too much and you are trying to get sub -type summaries inside each month/year which becomes more difficult as you would need unique formulas per type.
Are you married to this outcome design or could you use grouping at the Item instead like this?
Travelling Cost
Month MTD YTD
Jan $6800 $6800
Feb $ 1000 $7800
Mar $ 500 $8300
If you absolutely need it the way you orginally posted it are there only the 3 Item types (travel, medical, maintence) or are there more and can more be added?