Are you certain that you have not duplicated your data in the datamodell? Is your expression correct if you use this expression sum(CountOfOTS_Hist) and make a selection in the OTSHist field?
An alternative to If() is to use SET analysis. Try this expression: sum({<OTSHist={'On_Time'}>}CountOfOTS_Hist)