San Francisco Mayor Ed Lee has called for the creation or rehabbing of 30,000 housing units in the next six years — with half of them affordable to low or middle-income city residents.

But a new report from the California Housing Partnership Corporation, a nonprofit that aims to increase affordable housing units around the state, demonstrates that even the mayor’s major housing initiative falls short of the actual need. There is a shortfall of 40,845 units of housing affordable to the city’s very low-income residents, according to the report. Those residents are defined by making less than half of the area median income – which means that, say, a family of three that makes bring in less than $49,950 is considered in the report.

Some more startling statistics: Median rent in the city increased 22 percent between 2000 and 2012 (and anybody who’s not living under an overpriced rock knows that percentage is likely far higher now due to the tech-fueled economic boom that is driving rents way up.)

Meanwhile, median income has dropped 2 percent in that time, meaning many households are paying a higher percentage of their income on rent than they used to. Fifty-nine percent of very low-income households in San Francisco spend more than half their income on rent – and the conventional wisdom is that housing isn’t affordable if you spend more than 30 percent of your income on it.

Those low-income families who are managing to retain a foothold in the San Francisco housing market are often living in unhealthy or unsafe conditions and are crowding multiple people into each room. (The Chronicle recently reported on an uptick in families living in tiny, often squalid single room occupancy hotels without access to their own bathrooms or kitchens.)

The report figures that a salary of $78,240 is the minimum needed to afford fair market rent for a family of three in the city, but the report notes that leaves out wide swaths of the population including teachers, social workers, retail workers and food service workers. Meanwhile, local, state and federal funds to support affordable housing are dropping.

Ready to throw up your hands and hit the tequila? Don’t despair — there is hope, the report says. It recommends a number of statewide and local policy initiatives including replacing exhausted state housing bonds, strengthening rent control protections and voting for Prop. K on the local Nov. 4 ballot. That measure would recommend to city officials that a third of local housing production be affordable to low- and moderate-income residents.

Heather Knight is a San Francisco Chronicle staff writer. E-mail: hknight@sfchronicle.com Twitter: @hknightsf