How to do it?
It is very simple. First select the Slicer items box by clicking on the title. Then go to the Option menu
and select Slicer Setting.
Image 1: Options | Slicer Settings
Choose hide items with no data and click on OK.
Image 2: Slicer Settings
Slicer with no data has hidden after new settings:
Image 3: Slicer with no data has hidden