Getting the mean from grouped values in a results set (Grafana Table)

I have an influx database that looks like this -

package   | percent  |  failed  | ignored  | tests |  build  | browser | environment  
shades        86.0        8          0         57       23      chrome       QA
cards         56.4        14         3         39       23      chrome       QA
pages         66.4        30         10        119      23      chrome       QA
navigation    50.4        35         24        119      23      chrome       QA

In the past the company didnt care about trending data, so when the test pass finished, I just cleared the table and rewrote to it. Then I used this statement to create the table:

SELECT package, percent, failed, ign, tests FROM "package" WHERE ("desc" = 'membersui')

package   | percent  |  failed  | ignored  | tests
shades        86.0        8          0        57
cards         56.4        14         3        39 
pages         66.4        30         10       119  
navigation    50.4        35         24       119   

Now they want the data grouped and filtered by time and not quite sure on how to accomplish this.

What I would like to do is to group the $timeFilter'ed data sets by package name and then take a mean of the displayed fields. To do this for a single field it would just be -

Select mean("percent") FROM "package" WHERE ("desc" = 'membersui' AND $timeFilter)

Is there any way to create a table for all five fields? The best I can describe this in Pseudo-Code

Select package, mean(percent, failed, ignored, tests) FROM "package" WHERE ("desc" = 'membersui' AND $timeFilter)

Thanks guys and let me know if I can expand on anything else.

Just to double check, I assume that there is a time column in your database as well?

In InfluxDB, grouping is done with tags. Is package a tag key? And percent, failed, ignored and test are fields? If so then something like this should work:

SELECT mean("percent"), mean("failed"), mean("ignored"), mean("tests") FROM "package" WHERE $timeFilter GROUP BY "package"


I finally understand/comprehend Group By - Thank you very much for your help.