Yeats is addressing a question raised 2200 years earlier in the Bible in the Book of Ecclesiastes
Ec:1:2: “Meaningless! Meaningless!” says the Teacher. “Utterly meaningless! Everything is meaningless.” (In the earlier versions it is “Ec:1:2: Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.” And the word vanity is repeated in the final line of the poem.)
Ec:1:14: I have seen all the things that are done under the sun; all of them are meaningless, a chasing after the wind.
Ec:2:1: I said to myself, “Come now, I will test you with pleasure to find out what is good.” But that also proved to be meaningless.
Ec:2:2 “Laughter,” I said, “is madness. And what does pleasure accomplish?
Ec:2:11: Yet when I surveyed all that my hands had done and what I had toiled to achieve, everything was meaningless, a chasing after the wind; nothing was gained under the sun.
Ec:2:16 For the wise, like the fool, will not be long remembered; the days have already come when both have been forgotten. Like the fool, the wise too must die!
but the question was probably asked many times before that. “What is the point of life, when we know it will not be easy and will end in death and we will be forgotten?”
In short, Yeats (and the writer of Ecclesiastes) says that whether you chose to spend your looking for wisdom, in enjoying yourself, or you decide to become rich by hard work – at the end you will realise that life is meaningless.
The intellect of man is forced to choose the choice must be made between
perfection of the life, or of the work, spending you life in the pursuit of wisdom and happiness or dedicating yourself to work/ambition.
And if it [the intellect] take the second must refuse / A heavenly mansion, raging in the dark.
If the ambition is chosen, there will be no peace and tranquilly, only angry and impotent regret
When all that story's finished, what's the news? At the point of death, what can we conclude?
In luck or out the toil has left its mark: Whether you have been fortunate or not, the effort involved in either choice has scarred and damaged you
That old perplexity an empty purse, That eternal question contains no answers
Or the day's vanity, the night's remorse. nor did it hold the meaninglessness of your life, which ends in regret.