Wrong percent calculation in pie chart


I'm totally new at this board and just installed the pi-hole a week ago. It is working proberly, but I saw some strange behaviour regarding the pie charts in the dashboard and the calculation of them. It does not make sense and is mathematically wrong. My english is not the best, but hopefully you understand what I want to say. So here is a conclusion with some screenshots for better understanding:

  1. In the top it shows a blocking percentage by 27,1%, but in the pie chart below its at 33,8%:

  2. only with your eyes you can see that there is something wrong. Round about 30%+20% should be 50% and exactly the half of the pie. But it's not as you can see on the first pie. But If I calculate the 27,1% from the top plus the 20,6% from second pie (cache), it is 47,7% and makes more sense. There must be something wrong.

I also did a screenshot via the flutterhole app (the same data, just in a better view). Here you can also see that the overall sum is not 100%!

The sum here is: 126% !

What I did already:

  • restart (of course!)
  • flush dns
  • flush logs


1 Like

I was just about to report this too! :grimacing:

This basically shows 60% + 30% + 30% = 120% :see_no_evil:

1 Like

Same thing here.

I see 11.7% + 17.1% + 18,9% + 69% which sums up to 116,7%

  • The display at the top of the page is the blocked percentage of A and AAAA queries only.
  • The pie chart tells you the blocked percantage of all queries.

The discrepancy between the numbers on the chart and the chart itself is due to the fact that the numbers add up to more than 100 %, the chart obviously can't overlap itself. My guess is that some queries are accidentally counted in more than one category and so the individual categories add up to more than the total.

100% for me:

pi@ph5:~ $ nc localhost 4711 <<< $'>forward-dest >quit' | awk '{print $3 " " $2 "%"}' | column -t
blocklist       12.41%
cache           46.33%  39.95%     1.36%

Have any of you changed any settings in the last 24 hours that might need to trickle through the system first to display accurately ?

My guess was correct, when memory is filled from the database, for example after restarting pihole-FTL, queries that were blocked after CNAME inspection are counted as blocked and again as forwarded to the associated upstream server. They only go once into the total queries, though, therefore the total percentage goes over 100 %.

I don't know if that is also true if memory is generated live or if that is really only the case when read from the database. I'll open an issue on Github. (Actually, I just found an existing issue about the same problem that didn't get much attention: Pie chart percentages add up to more than 100 % · Issue #1612 · pi-hole/AdminLTE · GitHub)

1 Like

Made a little update with my findings on the github issue. Any opinions on the last part of my comment on the issue?:

@Daxtorim Thanks for your research. I see that this misbehavior doesn't appear in my test environment and neither do I see it as home, however, with all the different use cases for a Pi-hole - starting at different browsing habits and not ending at different devices and network setups - it became almost impossible th catch all the things.

I moved the issue ticket you referenced into FTL's namespace.

@Viandoriel @nero355 @h3rman Could you please try if

pihole checkout ftl fix/upstream_counts

solves the inconsistent counters for you?

The excellent research of @Daxtorim made it very easy to propose a solution. Now we need to find out if we covered all cases.


It does for me, great job! :+1:

Yes, also works on my system!
Thanks for the fast help! :slight_smile:

Thanks for your bug reports. The proposed fix is here

and will be released in the next version of Pi-hole. Make sure to go back on track with

pihole checkout master

either already now or before updating or you will not receive the update. pihole checkout anything else than master pins you to a specific version for resting. You will only receive updated on this branch until you go back to master.

Oh, thanks for the hint - I didn't know.

I now have the following :

Looks good! :slight_smile:

Aware of that so I am switching back now immediately! :+1:t2:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.