We can estimate the amount of time Walt worked for Gus at about six months. We used this handy Vulture article to help us out with the timeframe.
Walt's first three months of work were done at a rate of $3 million to be split with Jesse... or $1.5 million for the first three months.
Gus then re-upped their deal to pay $15 million for a year, split down the middle. This was confirmed in Season 4's seventh episode, "Problem Dog," when Skyler did some quick math as to how much Walt earned per year. She estimated about $7.1 million, to which Walt responded calmly, "$7.5 million minus expenses."
$7.5 million divided by 12 months is $625,000 per month. Walt worked for Gus for an additional three months on the new deal, making him $1.875 million.
So with six-month earnings equal to $3.375 million, we can subtract work expenses established by Walt as about $400,000 per year, or $200,000 per six months. That gives us an earnings total of:
$3,175,000