Pie chart with percentage

Hi,
I've written this query:

SELECT idMaxNet,COUNT(tagId) as num FROM "itt_data_bridgenuzoo" WHERE date >= CURRENT_DATE - INTERVAL '7' DAY AND idMaxNet!=0 AND (idMaxNet=128 OR idMaxNet=129 OR idMaxNet=130 OR idMaxNet=131) GROUP BY idMaxNet

and I have this result:

|idMaxNet |num |
129 25
131 29

I would put this data in a pie chart, with percentage. So: 100% is 25+29 = 54, than "129" is 46.3%, while "131" is 53.7.

how can I do?
Thanks

filters group="group1" ungrouped=true
| essql 
  query="SELECT COUNT(idMaxNet) as num,idMaxNet FROM \"itt_data_bridgenuzoo\" WHERE date >= CURRENT_DATE - INTERVAL '7' DAY GROUP BY idMaxNet"
| mapColumn name="labels" 
  expression={getCell "idMaxNet" | switch {case 131 then="Net 131"} {case 128 then="Net 128"} {case 129 then="Net 129"} {case 130 then="Net 130"} default="Altre Net"}
| pointseries color="labels" size="num"
| pie hole=50 
  palette={palette "#01A4A4" "#CC6666" "#D0D102" "#616161" "#00A1CB" "#32742C" "#F18D05" "#113F8C" "#61AE24" "#D70060" gradient=false} labels=true legend="ne"
| render

I had created groups and I had not set the variable correctly at the beginning of the expression

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