Can you specify what you consider "wrong"? It is normal that DFT produces a functional- and basis set-dependent offset from real experimental values for all of these properties, so there is a chance you didn't actually do anything wrong.
In principle, within the Kohn-Sham approach to density functional theory (DFT), the ionisation energy, work function and electron affinity of any material or molecule can be obtained from the single-particle Kohn-Sham energies. Specifically, the ionisation energy is the negative of the energy of the highest occupied Kohn-Sham molecular orbital, the work function is the difference between this energy (when the highest occupied orbital describes a surface state) and the energy of the vacuum level. The affinity is the negative of the lowest unoccupied Kohn-Sham orbital energy plus the 'derivative discontinuity'Article Density-Functional Theory for Fractional Particle Number: De...
. The derivative discontinuity equals the change in the gradient of the exchange-correlation energy with respect to the electron number about an integer value. For Transition-metal dichalcogenides (TMDs), the size of the derivative discontinuity can be significant and should be taken into account within DFT calculations.
In practice, Kohn-Sham DFT relies on approximations, such as the form of the exchange-correlation energy functional, which can limit the accuracy of the results. In addition, within many Kohn-Sham calculations the derivative discontinuity is completely neglected. As such, calculating the electron affinity is particularly unreliable with Kohn-Sham DFT. A common approach for improving the calculation of the affinity is the 'DFT+U' method Chapter The DFT+U: Approaches, Accuracy, and Applications
. This empirical method can be difficult to implement as it requires the determination of the U parameter which is a computationally-expensive process whose results are not transferable to other materials, or even the same material with a different DFT package. In general, Kohn-Sham DFT is an accurate method for calculating the ionisation energy of TMDs. However, it is important to note that there are some limitations to the method, and that the accuracy of the results can vary depending on the specific material.