Hi I am not able to share the code due to the database in on a secured network. Perhaps I can modify it so I will get back to you with this.
On that note could you help with a query though?
What I am trying to do is:
- Get the distinct values of the field 1.
- Find the percentage of the Distinct Values by dividing the distinct value by the total value of field 1.
- Counting all values in the three fields of the table then divide it by the distinct values to get the overall percentage.
Desired results:
Field 1 Distinct_Field Percentage_Field Total_Percentage_Field X 3 1% .01% Y 1 .01% .001% Z 2 .02% .02%
Modified version of Query one that will count the values in three columns.
<CODE>
SELECT Count([Field Table].[Field 1]) as Total_Field, Count([Field Table].[Location]) AS Total_Location, Count([Field Table].[Cars]) AS Total_Cars FROM Dealer;
</code>
Second query that will pull the results from query 1:
<code>
SELECT [Field Table].[Field 1], Count([Field Table].[Field 1]) As Distinct_Field, ([Distinct_Field] / Total_Field]) As Percentage_Field, ([Distinct_Field] / ( [Total_Field], [Total_Location], [Total_Cars])) AS Total_Percentage_Field
From Query
Where [Field Table].[Field 1] Is Not Null
GROUP BY [[Field Table].[Field 1];
Access does not like this. Not sure how to combined the distinct and apply the aggregate functions to get the above results.
Any Help is appreciated!!