Group data in Range

amantaj

New member
Local time
Today, 06:02
Joined
Nov 8, 2014
Messages
2
Hi everybody,

I need to group data (cases) in range like this (0-5, 6-10, 11-15 etc).

i can do this with the iif statement but this is a bit tedious.

i have two simple table:

1. Salestbl with two fields: a. customerid, b. Cases
2. Rangetbl with two fields: a. Range b. Category
The rangetbl is where i would define my range and it look like this
the range field have records 0,6,11 with corresponding category which look like this '0-5', '6-10', '11-15'

how can i use this to group my data. that is customer with x cases have group '0-5' or '6-10' etc

Thanks to help me.
 
Tag you rows with the resultant grouping you want.
 
Tag you rows with the resultant grouping you want.

Seriously? llkhoutx, it seems the majority of the posts I've seen by you are essentially you parroting back the initial posters question, but doing so like its advice. He asked about a good way to tag his data with groupings, your advice was that he should tag is data with groupings. Not helpful.

Here's what is: Attached is a database that does it for you. It consists of a table for ranges, a sample data of data that the ranges are to be applied to, a sub query that uses a function to assign ranges to the sample data, then a main query which produces totals based on that sub-query.

Hopefully you can use that, if you have any questions let me know.
 

Attachments

Check out the Partition function. You might not need to use a table to store the ranges.
 

Users who are viewing this thread

Back
Top Bottom