A search would bring up numerous request about chain length. The answers are always the same. You can wrap the chain around the big ring and largest cog, bypassing the RD. Bring the ends to together and add 1-inch (two links) if the ends that come together can be joined (inner plates and outer plates). If the plates that come together are the same, add 3 links. That is the shortest chain length that will wrap the big/big combo.
The other method is the little/little method, that insures the maximum chain length and wrap capacity. This method routes the chain the through the RD. The length should be the longest that does not allow the chain to hang loose or rub on the RD cage due to a lack of tension.
The problem you may encounter is a lack of wrap capacity and clearance between that 34T cog and the upper jockey pulley on the RD. You can't just just change cassettes like that without knowing the RD's wrap capacity and largest cog capacity.