I would possibly look at modifying the code to the following
Select
AgencyName,
PerName,
Branch,
(SUM(case when ttt.State = 5 then ttt.OfferCount else 0 end) as Done,
(SUM(case when ttt.State != 5 then ttt.OfferCount else 0 end) as NotDone
from
(select TB_Agency.AgencyName, TB_Personel.PerName, TB_Offer.State, count(TB_Offer.Branch) as OfferCount,
TB_Offer.State
from TB_Agency
join TB_Personel on TB_Agency.AgencyID= TB_Personel.AgencyID
join TB_Offer on TB_Personel.PerID = TB_Offer.PerID
GROUP BY TB_Acente.AgencyName, TB_Personel.PerName, TB_Offer.Branch,TB_Offer.State
)
as
ttt
The only other way I could think of doing such a query would be to use Common Table Expression, but then I have made an assumption that you are running Sql Server