Returning entries that contain both categories
Answer for Craft 2
Your final result should not look like relatedTo('and', '1,2') but
relatedTo('and, 1, 2')

Or
relatedTo(['and', 1, 2])

So you just need to do
relatedTo('and,' ~ param)

Keep in mind to code defensively, so you might want to check if your query param is not null or something
Answer for Craft 3
relatedTo(['and', ['element' =&gt; 1], ['element' =&gt; 2]])