What do you mean with 'not giving me proper result' exactely?
Start with checking the MaxDate table, if the MaxDate has been loaded correctly. Comment the Drop Table MaxDate; and check the records in table viewer.
Then check the variable that fetches the MaxDate ( I would also write it like this):