Housing markets across the country are seeing big shifts due to two generations who are at a time of their lives that generally come with a change in where and how they are living.

Tim Boyle, Getty Images

A new report from RealtyTrac analyzed where millennials and baby boomers have been leaving and where they've been going over the past six years. Both generations followed a general pattern, but the patterns are nothing alike.

With a tradeoff of more jobs and higher median incomes, millennials have generally been moving from lower-priced to higher-priced markets, according to the report.

Daren Blomquist, vice president of RealtyTrac, said people between the ages of 22 and 37 have also been migrating to areas of higher population.

"That's the type of lifestyle that they like, but it's also where the jobs are," Blomquist said.

Hudson County, New Jersey ranked among the top 10 counties nationwide for biggest percentage increase in the millennial population between 2007 and 2013.

Baby boomers, meanwhile, have been following a different path.

"They're moving to markets that actually have higher unemployment rates than where they're moving from," Blomquist said. "They don't care as much about the jobs because they're either at retirement or very close to retirement."

The analysis found boomers were focused more on quality of life, and they typically made an effort to leave densely populated areas.

Blomquist said the millennial generation is the key to a sustained real estate recovery, and boomers, while driving up demand in the markets where they're searching, are helping open the door for many first-time homebuyers by leaving the nest they've had for years.