In a Power BI Pie Chart total 8 legends(category) are there and count is distributed by category as shown in 1st pic. When I select Only June 2020 (2nd pic), there is data only for 5 category and accordingly it is distributed in Pie Chart. In both images, there are 8 legends are shown in right side. Is it possible to hide the legend if there is no value for that legend. for example : in 2nd image, possible to hide remaining 3 legends and only shown legends for which data is there?
As suggested by Agustin I created below measure:
FilterMeasure = INT(NOT(ISEMPTY(Filter(TableName,TableName[Category]=TableName[Category]))))