If having a house is necessary in common view and not having a house will put you into severe difficulty that is not normally bearable, in this case, Khums is not payable on the money which you save for buying a house.
According to Grand Ayatollah Sistani, if not buying a house is considered in your community as a sign of neglecting your duties toward your family, then the savings done over the years for that purpose will be considered as the allowable expenses of those years in which case khums will not be payable on the saving.