As Wachau is one of the most exciting courses of Austria, a boat trip from Melk to Krems is inevitable. Of course the reverse direction (Krems to Melk) is also possible; but I advise the former one.
But be aware and do not skip to disembark at Dürnstein town. Climbing to the castle ruins using the stony old road (Eselsteig) takes you 20 minutes filled with excitement as the Donau panorama lifts at each step with an increasing magic splendour. Walking sticks and shoes are advisable.
Once down to the town you can spend some more time enjoying narrow and historic streets and tasting local culinary artefacts. If it is time to depart do not take the train or bus, because Krems is within walking distance. The well paved and marked road will take you through Wachau wine regions vineyards and then medieval streets of Stein town till the historic city center of Krems where you can pick a train to Wien each hour.
In short; a visit to Wien without Wachau is incomplete; so is a Wachau trip without a Dürnstein stop.