ScriptSoft
ScriptSoft

Reputation: 183

Can legends in PowerBI Pie Chart be hidden if value is zero?

All data by Category June2020 Data By category

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?

Upvotes: 1

Views: 5939

Answers (3)

zach
zach

Reputation: 1241

The solutions here didn't work for me, so I ended up convincing the customer to use a bar chart, and then I used the deneb visual to meet the requirements.

Upvotes: 0

ScriptSoft
ScriptSoft

Reputation: 183

As suggested by Agustin I created below measure:

FilterMeasure = INT(NOT(ISEMPTY(Filter(TableName,TableName[Category]=TableName[Category]))))

and below is filter pan: enter image description here

Upvotes: 0

Agustin Palacios
Agustin Palacios

Reputation: 1204

First create a measure using the following dax function:

Cross Filter = INT( NOT( ISEMPTY( FAC_TABLE ) ) )

Select your visualization, open the filter panel and drag the measure in the Filter on this visual option. Finally select the option equal to 1. The following image is in spanish but you will get the idea.

enter image description here

Hope it helps.

Upvotes: 2

Related Questions