Hide empty sections in list view

This is possible in the “Group By” panel, as shown in this answer: Allow hiding of "no value" groups in List view