20 by 40 is a pretty large deck. You might want to call around for pricing in your area. National average is going to be $10 to $20 per sq ft. But then again the material does matter. There's also the matter of how difficult the area of deck location is. Is the lot sloped or level. Will there be different levels, built ins, rails, stairs. Check out the deck pricing guide, they go into details pretty good.
To estimate the cost of building wood decks, you need to plan the size of your deck and choose the right shape. Then, determine the approximate square footage of your deck. Determine the number of deck pieces, the lumber and extra pieces you will need. Finally calculate the total cost by multiplying the base cost times 1.5 for hardware miscellaneous.