Creating a Chart for a Table to show number of rows with given column value
Asked by Jordan Govreau:

I thought this would be pretty easy to accomplish, but I'm unable to figure this out. I'm thinking there should be an easy solution...

Say I have a table with rows that represent information on different cars. Each row represents a different car and columns for things like color, horse power, number of doors, etc.. Each car is categorized into a 'sub-class' of sorts, say "Sports car", "Luxury car", and "Standard car". The table has a column with this sub-class categorization data. I want to create a chart to show how many rows have each of the categories. So basically I want to see there are X amount of sports cars, Y amount of luxury cards, and Z amount of standard cars.

I tried creating a chart using the car category column as the labels column and the car name column as the values column, but I get the following error:

"Probably, there is no data in the Values column. Please, select the column with data values for chart generation."

It seems like there should be an easy solution, but I'm not seeing it...


Answers:
author: Natalie Paramonova [Stiltsoft]
body: Hi [@Jordan Govreau](/t5/user/viewprofilepage/user-id/3663047) ,

Please wrap your source table in the [Pivot Table](https://docs.stiltsoft.com/display/TFAC/How+to+use+Pivot+Table+macro?utm_source=atl_community) macro ([Table Filter and Charts for Confluence app](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=cloud&tab=overview&utm_source=atl_community)) to count the number of rows in each category because the [Chart from Table macro](https://docs.stiltsoft.com/display/TFAC/How+to+use+Chart+from+Table+macro?utm_source=atl_community) requires numeric values when building a chart.

After that wrap the Pivot Table macro in the Chart from Table macro to build a chart based on the aggregated data:

![2019-12-05_16h51_28.png](https://community.atlassian.com/t5/image/serverpage/image-id/75218i2CAE99CF7F95209D/image-dimensions/843x605?v=v2 "2019-12-05_16h51_28.png")

The Pivot Table macro configuration:

![2019-12-05_16h51_45.png](https://community.atlassian.com/t5/image/serverpage/image-id/75219i46FCC72BF7B2FE12/image-dimensions/702x435?v=v2 "2019-12-05_16h51_45.png")

The Chart from Table macro configuration:

![2019-12-05_16h52_06.png](https://community.atlassian.com/t5/image/serverpage/image-id/75220i05C3334CE2CB2A2A/image-dimensions/701x433?v=v2 "2019-12-05_16h52_06.png")

Please let me know if it works for you.

comments: author: Jordan Govreau
body: Thanks Natalie, this is exactly what I'm looking for!

Is there any way I can not show the pivot table? I really only want to display the original table and the chart.


author: Natalie Paramonova [Stiltsoft]
body: In case you [hide the source table](https://docs.stiltsoft.com/pages/viewpage.action?pageId=42239753#ChartParameters-Hidethesourcetable) in the Chart from Table macro, you won't see both pivot and the source table.

As a workaround, you can use the [Table Excerpt and Table Excerpt Include](https://docs.stiltsoft.com/display/TFAC/How+to+use+Table+Excerpt+and+Table+Excerpt+Include+macros) macros.

Wrap your source table in the Table Excerpt macro and place the Table Excerpt Include macro in the Pivot Table macro body.

![2019-12-06_11h32_24.png](https://community.atlassian.com/t5/image/serverpage/image-id/75389iDCA70007946E90D3/image-dimensions/804x462?v=v2 "2019-12-06_11h32_24.png")

The Table Excerpt macro configuration:

![2019-12-06_11h32_52.png](https://community.atlassian.com/t5/image/serverpage/image-id/75390iFA254F91FEB8B56A/image-dimensions/659x411?v=v2 "2019-12-06_11h32_52.png")

The Table Excerpt Include macro configuration:

![2019-12-06_11h33_19.png](https://community.atlassian.com/t5/image/serverpage/image-id/75391i7B4D27E925B0B98E/image-dimensions/662x412?v=v2 "2019-12-06_11h33_19.png")

Set the Hide the source table option in the Chart from Table macro:

![2019-12-06_11h33_42.png](https://community.atlassian.com/t5/image/serverpage/image-id/75392i52EF3B26FC0843CF/image-dimensions/664x414?v=v2 "2019-12-06_11h33_42.png")


Tags: confluence-server

server