I am writing code to select the maximum value from a column that does not equal two other large values. The maximum will always be the 3rd largest value. The two largest values are place holders, (int) in year month format 999912, and 999901.
I have tried using Max and Filter together with no luck.
val maxSurvey = s.max("SurveyMonth").filter(survey("SurveyMonth") =!= "999912" && survey("SurveyMonth") =!= "999901")
I expect the current result to be 201902.
s.filter($"SurveyMonth" != ""999912" && $"SurveyMonth") != "999901").max($"SurveyMonth")