I think this goes as far back as Herodotus:
"Oh! Croesus," replied the other, "thou askedst a question concerning the condition of man, of one who knows that the power above us is full of jealousy, and fond of troubling our lot. A long life gives one to witness much, and experience much oneself, that one would not choose. Seventy years I regard as the limit of the life of man. In these seventy years are contained, without reckoning intercalary months, twenty-five thousand and two hundred days. Add an intercalary month to every other year, that the seasons may come round at the right time, and there will be, besides the seventy years, thirty-five such months, making an addition of one thousand and fifty days. The whole number of the days contained in the seventy years will thus be twenty-six thousand two hundred and fifty, whereof not one but will produce events unlike the rest. Hence man is wholly accident. For thyself, oh! Croesus, I see that thou art wonderfully rich, and art the lord of many nations; but with respect to that whereon thou questionest me, I have no answer to give, until I hear that thou hast closed thy life happily. For assuredly he who possesses great store of riches is no nearer happiness than he who has what suffices for his daily needs, unless it so hap that luck attend upon him, and so he continue in the enjoyment of all his good things to the end of life. For many of the wealthiest men have been unfavoured of fortune, and many whose means were moderate have had excellent luck. Men of the former class excel those of the latter but in two respects; these last excel the former in many. The wealthy man is better able to content his desires, and to bear up against a sudden buffet of calamity. The other has less ability to withstand these evils (from which, however, his good luck keeps him clear), but he enjoys all these following blessings: he is whole of limb, a stranger to disease, free from misfortune, happy in his children, and comely to look upon. If, in addition to all this, he end his life well, he is of a truth the man of whom thou art in search, the man who may rightly be termed happy. Call him, however, until he die, not happy but fortunate. Scarcely, indeed, can any man unite all these advantages: as there is no country which contains within it all that it needs, but each, while it possesses some things, lacks others, and the best country is that which contains the most; so no single human being is complete in every respect- something is always lacking. He who unites the greatest number of advantages, and retaining them to the day of his death, then dies peaceably, that man alone, sire, is, in my judgment, entitled to bear the name of 'happy.' But in every matter it behoves us to mark well the end: for oftentimes God gives men a gleam of happiness, and then plunges them into ruin."
Tldr: Call no man happy until he is dead.