As we come into Daniel 5-6, we witness the end of the Babylonian Empire and the overtaking of them by the Persians. Just as God had predicted back in Daniel 2 in the famous vision of Nebuchadnezzar's colossus' , the empire of the Medes and Persia did indeed take over.
Joseph suddenly was brought before Pharaoh to interpret a dream, likewise Daniel was brought before Belshazzar to interpret the hand writing on the wall. Daniel was thrown into a lion's den in Daniel 6 and Joseph had spent time in a pit (thanks to his brothers) and then again later on in a dungeon in Egypt. Joseph was a man of integrity and uprightness, with scripture recording no failure of faith on his part, so the same with Daniel. Then finally, God elevated Joseph to second in command in Egypt and gave him success and Daniel too was elevated to a high position (third position) and also had success. God proved himself faithful.