Stacking is a folder specific function.

If you are within a collection, a metadata grouping, keyword grouping, etc., then the stacking options will be grayed out.

A quick way to jump to the folder of an already selected image is to expand the Metadata panel and click the right-facing folder arrow.