But if you can afford to field a hundred knights, I can afford to field a few thousand crossbowmen. I'd estimate that a heavy crossbow would cost about as much as a good sword. Then the knight needs a full suit of armor (several more crossbows) and a couple of war horses (a very large pile of crossbows).
Then the knight needs to spend years training. Learning to use that sword. Learning to use a lance. Learning to wear that armor and building the strength to do so. Learning to ride a war horse at full gallop while using a lance in one hand and a shield in the other. Learning to fight with sword and shield while keeping an excited horse under some semblance of control. It's a full time job and requires a bunch of people just to support the knight, who has no time for useful labor.
A crossbowman can learn the basics in a couple weeks, and doesn't really need much more. A couple of days learning how to use the crank to load the thing. A few days of practice to get the bolt to go to the right area. Precision shooting isn't needed when a few thousand people fire at a few hundred.
You would be right but you are ignoring several important economic points;
1. A knight would have been in training anyway, whether you were going to need them or not.
2. A knight would not be 'afforded' as such; a knight would be there. If they do not wish to join the fight they'll have to buy the right to stay home so you an replace them with mercenaries.
3. A sword and armour industry would have been around for a while before the crossbow became important enough to effectively displace knighthood from battlefield prominence.
4. A knight would have access to his family's armoury in much shorter time than you'd need to attract professional crossbowmen. You can of course buy a bunch of crossbows instead (or have them made) and give those to peasants, but mercenary professionals will be much more useful than peasants.
5. A knight is in your service (or if you are the king it's more likely that they are in the service of those who are in the service of your direct vassals), a peasant is not particularly keen to take up arms, certainly less so than a knight. A mercenary crossbowman, a professional, is more likely to simply fight for the guys who pay more.
Other than that, yes, a few thousand crossbowmen will make a shambles of a few hundred knights, definitely. I don't think I ever said they wouldn't.
Again, my brother adds to my point before I make it.