Kindly tell me how to calculate khumas from the money which will be left with me after i minus expenses etc. method ? and if i am left with some money,will i give khumas for the same fixed month or for the whole year ? and what if money are less than tha whole year khumas amount ? please explain

For example in year 2017 your saving was 5000 and you paid the khums which was 1000 and 4000 left with you next year if in 2018 your saving is 4000 or less then khums is not wajib you have to pay khums on the amount which is above 4000.