Results 1 to 6 of 6
  1. #1
    Ryan86 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    4

    Counting Unique Combinations of Item #s and Store #s

    I have a table that has the two columns... Item # and Store #. Each store can have any combination of hundreds of items, so store numbers are repeated in column A for each new item # listed in that store in column B. I need to find a way to count how many stores have the exact same combination of items in there stores. So if Store 1 and Store 2 both stock the exact same combination of items it would great to somehow assign a unique ID to that combination and count how many there are. I have tried using crosstab queries to sort the store #s into rows and then item number across the headings, but I still then have the same problem of needing to know how many entire records are unique. Perhaps it is easier from this point see attached small mockup table for an example of what the crosstab query would generate (Coluumn headers are item #s). The Y signifies that item is stocked in the that store. From that point I would need to write a query to determine how many unique entire records there are and then count them.

    Store # 20 21 22 23 34
    1 Y Y Y
    2 Y Y Y
    3 Y Y
    4 Y Y
    5 Y Y

    Attached Thumbnails Attached Thumbnails table screenshot.jpg  

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,738
    Show us the design of this table
    I have a table that has the two columns... Item # and Store #

  3. #3
    Ryan86 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    4
    Attached are the Table view and Design view. As you will see there will be more field names, than just item and store but those are irrelevant as to what I am trying to do, essentially I can delete all that data.Click image for larger version. 

Name:	design view.jpg 
Views:	5 
Size:	80.1 KB 
ID:	6533Click image for larger version. 

Name:	table view.jpg 
Views:	4 
Size:	68.3 KB 
ID:	6534

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,738
    Try this query (untested) and see if it's what you're looking for.

    Select StoreNumber,StoreNumber & ItemNumber, Count(ItemNumber)
    FROM YourTableName
    Group By
    StoreNumber,StoreNumber & ItemNumber;

  5. #5
    Ryan86 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    4
    Quote Originally Posted by orange View Post
    Try this query (untested) and see if it's what you're looking for.
    This doesn't achieve what I am trying to accomplish. Here maybe is a better understanding of what I am trying to get. In the attached picture I have run a crosstab query that shows store numbers in the Rows, and item numbers across the columns. Each row shows (via a 1 indicator) which items are stocked in that store. What I then need to accomplish is know how many stores share the exact same combination of items. In the provided example it would be 3 different combinations, highlighted different colors. Its almost like I need to find out how many rows are entirely duplicated (exluding the store number).Click image for larger version. 

Name:	crosstab.jpg 
Views:	4 
Size:	37.5 KB 
ID:	6535

  6. #6
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,738

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Unique queries - Unique Count
    By bigfish in forum Queries
    Replies: 7
    Last Post: 03-14-2012, 01:28 PM
  2. Replies: 7
    Last Post: 10-25-2011, 08:32 PM
  3. Calculating all possible combinations
    By Data in forum Queries
    Replies: 3
    Last Post: 06-20-2011, 03:02 PM
  4. Query for All Possible Combinations
    By Rawb in forum Queries
    Replies: 1
    Last Post: 10-09-2010, 08:33 PM
  5. Replies: 24
    Last Post: 09-01-2010, 02:09 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums