NGC 6791 is one of the most studied open clusters , it is massive ( \sim 5000 { M } _ { \odot } ) , located at the solar circle , old ( \sim 8 Gyr ) and yet the most metal-rich cluster ( { [ Fe / H ] } \simeq 0.4 ) known in the Milky Way . By performing an orbital analysis within a Galactic model including spiral arms and a bar , we found that it is plausible that NGC 6791 formed in the inner thin disc or in the bulge , and later displaced by radial migration to its current orbit . We apply different tools to simulate NGC 6791 , including direct N -body summation in time-varying potentials , to test its survivability when going through different Galactic environments . In order to survive the 8 Gyr journey moving on a migrating orbit , NGC 6791 must have been more massive , M _ { 0 } \geq 5 \times 10 ^ { 4 } M _ { \odot } , when formed . We find independent confirmation of this initial mass in the stellar mass function , which is observed to be flat ; this can only be explained if the average tidal field strength experienced by the cluster is stronger than what it is at its current orbit . Therefore , the birth place and journeys of NGC 6791 are imprinted in its chemical composition , in its mass loss , and in its flat stellar mass function , supporting its origin in the inner thin disc or in the bulge .