Real Madrid's transfers in recent years have generally been very good. James Rodriguez aside, most of the players they bought were either successful there or sold for profit. It helps them that they are often shopping in Spanish market and the level of talent pool is fantastic.
They've also had plenty of poor years in the transfer market prior to that:
Beckham wasn't much of a success for them and cost them 37,5 million, which was quite an amount at the time.
Walter Samuel was bought for 23,5 million and sold for 18 million a year later.
Julio Baptista was bought for 20 million and sold for 10 million several years later, not really being a success there.
Jonathan Woodgate was bought for 18,3 million and sold for 9,6 million several years later.
Emerson was bought for 16 million and sold for 5 million a year later.
Sneijder was bought for 27 million and sold for 15 million a couple of years later.
Robben was bought for 36 million and sold for 24 million a couple of years later.
Kaka was bought for 65 million and left for free three years later.
Huntelaar was bought for 27 million and left for 15 million a year later.
None of these players really had much of an impact for them, which of course also had to do with their struggles on the pitch. Either way, it's important to learn from mistakes committed in the past.