Forum Discussion

elcamino's avatar
elcamino
Frequent Visitor
5 months ago
Solved

Donut Chart - dynamic percentage

Hello everyone,

 

This donut chart shows the total of area and the percentage. It shows the correct data.

 

However, when i select one store it shows the right area, but it still shows 100%. When, in fact, the store chosen do not correspond to 100% of the total area - it should be 75/181,39*100 = 41,35% .

 

How to solve this?

 

Thank you very much

 

 

 

  • Hi elcamino 

     

    When filters are applied, Power BI calculates pie/donot chart percentages based on the total of the visible crows. So, if only a single category is selected, the numerator and denominator are the same, resulting in 100%. Unfortunately, in donut and pie charts, data labels cannot be set to use a separate measure for custom percentages. A workaround is to use Deneb, though this requires some coding.

     

    Please see the attached sample pbix

     

3 Replies

  • hi elcamino, the problem with context transition. this whats happening. When you are using the measure, its taking consideration of totals on the current filter context. So when you are using sclicer, the current filter calculate the totals and the chart is calculating the % based upon that total. As you are using the chart formating pane to show data and percentage of total, the native "% of total" label can only calculate a percentage based on the data currently available inside that specific visual's query.
    You need to use explicit measure using ALL or ALLSELECTED based on your requirment and use seperate visual. I donut chart, it wont be possible.

  • Hi elcamino 

     

    When filters are applied, Power BI calculates pie/donot chart percentages based on the total of the visible crows. So, if only a single category is selected, the numerator and denominator are the same, resulting in 100%. Unfortunately, in donut and pie charts, data labels cannot be set to use a separate measure for custom percentages. A workaround is to use Deneb, though this requires some coding.

     

    Please see the attached sample pbix

     

  • Once you filter to a single store, Power BI calculates the label percentage against the visible total inside that visual, so that slice becomes 100% of the filtered donut, not 41.35% of the original total.

     

    The practical wokarounds are:

    • keep the donut for the area value and show the true percentage in a separate card/measure
    • or use a custom visual like Deneb if you want the donut label itself to show your custom percentage.