Total count under table footer is calculating wrong

This issue is only happening when using grouping to matrix transformation

@usman.ahmad please help me to fix this issue

Hi @sagarmeadepu,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

As you are posting probably for the first time so please always try to provide as many details as possible and keep the post title (aka subject) small and meaningful for visibility. (I have edited and corrected it now).

Please review the submission template and include more details:

  • What Grafana version and what operating system are you using?
  • What is your datasource?
  • What visualization panel you are using e.g. time-series, bar chart, histogram etc?
  • What are you trying to achieve?
  • How are you trying to achieve it?
  • What happened?
  • What did you expect to happen?
  • Can you copy/paste the configuration(s) that you are having problems with?
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
  • Did you follow any online instructions? If so, what is the URL?

Hi @usman.ahmad ,

Thanks for your reply , Here is the details which your asked for

Grafana Version : v9.3.6
OS : Linux
Datasource : Bigquery
Visualization : Table

Bigquery returns below data :

|appVersion|date_d|Count|
|6.15.24|23/03/23|1|
|6.15.32|22/03/22|69|
|6.15.30|22/03/23|9|
|6.15.14|22/03/22|1|
|6.15.26|23/03/22|1|
|6.15.36|23/03/23|64|
|6.15.36|22/03/23|813|

My expectation is to transform this data like below :

|appVersion|23/03/22|23/03/23|Total|
|6.15.24|4|6|10|
|6.15.32|0|67|63|
|6.15.30|45|88|133|
|6.15.14|33|88|121|
|Total|88|249|337|

To achieve this solution in Grafana UI table visualization I have opted for one of the transformations called grouping to matrix

After using the group to matrix I have identified that whenever any of the appVersion is not available for any of the dates the transformation is adding an empty string there as a value, because of this empty string the total calculation is messed up it’s giving the wrong count.

I have also tried override feature to convert empty string to numeric but still its not working

Below is a screenshot of the wrong calculation when there is an empty string :

Here is the grouping to matrix example:

Definitely a bug

It is so coincidence that I can see many getting this issue.
I am able to resolve it by converting the matrix pivoted fields to numeric… try it

1 Like

Hi @tdk,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

We would appreciate if you can possibly share the solution in step-by-step instruction

OR

share a screenshot or a small screencast/gif file so that we can see how you are able to solve it.

Thanks

@tdk ,

Request you to share some screen shot of how you have implemented , it will help us to resolve issue

@usman.ahmad ,

This issue is opened form a long, could you please help me with solutions?

Hello :wave:,

When you are using “Grouping to matrix” transformation, you most probably need to also use “Convert field type” transformation as well to manually convert the column cells to type Numeric, if they are not being calculated correctly.

Hope this helps!

1 Like

I had the same problem, it is solved when In the grouping to matrix Field [Empty Value],
replace the value “Empty” for “Null”, after that the sum was done correctly.

Hi @valknutdevelopments

Can you please share a screenshot so that it can help other community members?