Related post based on 2 categories

You can do it like below-

$query = get_posts( 
        array( 
                'category__and' => array( 
                    6, // Your category-1 ID
                    7 // Your category-2 ID
                    // And so on and so fourth
                ) 
        ) 
);

Now in $query variable you’ll get the object of posts which are in both Category 1 and Category 2 and so on and so fourth.

Hope that helps.