Not everything I write is relevant for my business so I’m selective. But basically, Google will keep the first instance it finds as the main source. If you post on Medium first, the Medium version will always be the “authority” for Google. What’s important is that they don’t index everything right away. So you should wait before posting somewhere else. I wait at least 24 hours.
That being said, you can use Medium’s canonical link to specify another site as the original post. I have never used it however.