In calculating the carry of a spot-starting swap, you're essentially determining the "carry" or the profit or loss that arises from the difference between the fixed rate and the float leg fixing. The Dv01 (Dollar Value of a Basis Point) is used to measure the sensitivity of the swap's value to a one basis point (0.01%) change in the interest rate.
In your example, the 5-year fixed rate is 4%, and the float leg fixing is 2%. The Dv01 of a 6-month to 4.5-year swap is given as 3.
The formula you're using for the 6-month carry:
6-month carry=Fixed Rate−Float Leg Fixing/Dv01
This formula is calculating how much you would gain or lose for a one basis point change in the interest rate, considering the sensitivity of the swap's value (given by Dv01). In other words, it's assessing how the swap's value changes due to the difference between the fixed rate and the float leg fixing.
The reason you're using the Dv01 of the forward starting swap (6-month to 4.5-year) is that you're trying to measure the impact of a change in interest rates over the period in question (6 months to 4.5 years). The Dv01 of the spot-starting swap would not capture this specific time period and would not be appropriate for measuring the carry over the chosen period.
By using the Dv01 of the forward starting swap, you're aligning your calculation with the actual time frame (6 months to 4.5 years) over which you're assessing the carry.