0

I have created a query which returns the percentage of customers in my table that are male v female.

The results when I run this query look like so:

enter image description here

When I turn this query into a report (in tabular form) i have these two values nicely laid out. However, I also wish to have a pie chart in the report.

I have run the chart wizard and gone through it numerous times attempting to get a result, but each time i simply end up with either a completely blank pie chart, or a completely full pie chart.

I have also created a query which gives me the results in the form of integers (male customers = 13, female customers = 7) and tried the wizard using those values to only achieve the same result.

I also tried creating a query with a total count and tried to make a pie chart with that value and the 'male customers' value but again to no avail.

Does anyone know how to create a working pie chart?

Thanks

Edit: I should mention that I have already tried to find a solution to this on the internet but haven't found anything that works.

Edit2: I'm not sure if this helps but as I said above, i am also able to create a query which yields these results:

enter image description here

Edit3: Redid the queries as serperate

'Customer Gender Qry FEMALE':

SELECT Sum(IIf(cust_title In ("Ms","Miss","Mrs"),1,0))/Count(cust_title) AS Percentage
FROM [Customer Table];

enter image description here

'Customer Gender Qry MALE':

SELECT Sum(IIf(cust_title="mr",1,0))/Count(cust_title) AS Percentage
FROM [customer table];

enter image description here

BlueRhapsody
  • 93
  • 2
  • 13

1 Answers1

1

You need two rows for your chart. So build two querys, one for male and one for female customers. Combine them with a UNION Query and be careful, that the percentage-column is named equally in both sub querys. That is your source for the chart.

See also How to add a pie chart to my Access report

Community
  • 1
  • 1
asdev
  • 943
  • 6
  • 9
  • I'm not sure what you mean by a UNION Query, sorry, I'm new to SQL. But I think I have done what you said in regards to building individual queries. I will edit my post to show my new queries. – BlueRhapsody Sep 23 '15 at 12:46
  • Just an advice: Mostly it is useful for beginners to redo a tutorial on your own test database environment. Especially, when the tutorial is so detailed like in the link. After that it is much easier to transfer the gained tutorial knowledge to the actual problem. – asdev Sep 23 '15 at 12:54
  • I found a pretty good tutorial on union queries, so i will get back to you if i still can't figure it out. Edit: I got it! Thanks for your help! – BlueRhapsody Sep 23 '15 at 12:54