Some say anything can happen in cricket, the best player of the world can get out at his first ball while the bottom order batsman may score a century. Sometimes its your day and sometimes it is not.
Cricket in itself is too volatile, a player playing at run a ball is seen having the strike rate of more than 200 while a player trying to build an innings is seen to get out early. So a player who has put in a lot of hard work in practice may get out early, while the other may score a decent score. So does that mean the player who had put in a lot of hard work is not a good player? The answer is no, as I mentioned sometimes it's not your day.
Now coming yo your question as to which batsman is better Shikhar Dhawan or Virat Kohli. Shikhar Dhawan started his career long after Virat Kohli. So obviously Virat had played a lot of more matches than Dhawan be it Fifty over matches or White Ball Cricket or 20-20 cricket.
Both of them are good players of spin as well as pace and both batsmen have a good temperament. Both of them have good records in domestic cricket, international cricket and league matches. But when you talk of better batsman it is always the Virag Kohli you would hear from the people too. The way Virat Kohli has shown improvements after he had been made the Captain of the Indian Cricket Team.
There was a time when Virat Kohli was shining like anything, in every other match you would see him scoring a century in international matches at international venues. Kohli has far more records than Dhawan in International matches, making him the King Kohli.
And also as a leader you would see Kohli has an upper hand. As a captain he has many records under his bucket but are far less when compared with MS Dhoni, the coolest captain ever. His temperament, positive attitude towards game, learning will, and beat the best thing make him a better person and a sportsman than Shikhar Dhawan.
No matter how good virat kohli is and how far better he is than Shikhar, but his team has never won an IPL title in 11 years of history. Neither he has played that consistently in IPL matches as that of Shikhar. Still he is the second person to score 5000 runs in IPL which says is all.