When you try to help others overcome their sadness, don't demand perfection. Don't expect to always be successful in cheering up every person every time you try. Demanding such perfection will lead to discouragement when you are not successful.
It is not realistic to expect perfection, but if you personally master an optimistic outlook on life and try to cheer up others, you have a chance of succeeding frequently. Be grateful for your successes, even partial ones, and learn from instances what doesn't work.