Link to home
Start Free TrialLog in
Avatar of AndyC1000
AndyC1000

asked on

Generate and multiply combinations of fields

Dear all,

I have a table described below with values.  I have inserted column references above to better explain the scenario.

User generated image
I'm trying to reconfigure the dataset for each combination of the fields displaying the multiplied the value.
 
The number of combinations will be 2X2X3X2X2 = 36 combinations

C and D are Age fields
E to G are fields related to number of drivers
H and I are use fields
J and K are the number of doors in the vehicle.

i.e. C*E*H*J = 0.24

The output should look like the output above.
Note,  the example is a subset of the results because it is only for 1 age type.
 
 
What is the best approach to achieve this?  As I started working on the database query it became quite tedious I was selecting each combination to calculate the result.  

Thanks.
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

This is all very confusing...
2X2X3X2X2 = 36 combinations
C*E*H*J = 0.24 (only 4 combinations)

It is also not clear what this data represents, ...so an overview of the input data would be helpful.
For example:
Does "Sedan" represent a single car, or all "Sedans?
What is this output trying to display, specifically?
...etc

Can you post the *Full, Exact* results set you need.
(based on all the input data)
...then include a clear mathematical explanation of how each value was calculated...

Perhaps the data structure needs to be re-thought...?
Its just that, ...if all these machinations are needed, then perhaps the design is not optimized for what you are trying to do.

Lets see what the other experts may post...

JeffCoachman
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AndyC1000
AndyC1000

ASKER

Thanks for your comments.

I read through my question and yes its not clear.

I have 2X3X2X2 = 24 combinations.  I mistakenly added the car types in the initial question (which was the extra x2)

The total of the Age fields (Column C and D) = 1, Number of Drivers (Columns E, F, G) = 1, Use fields (H and I) =1  etc. in every row.

C and D are Age fields
E to G are fields related to number of drivers
H and I are use fields
J and K are the number of doors in the vehicle.

Each row in the input table represents 24 profiles (combinations of Age, Drivers, Use and Number doors).

C*E*H*J = 0.24 is 1 of the 24 combinations.

I will create the 24 queries and use union as suggested above.  

The full extract of the result set is:
User generated image
Is it possible using Visual Basic ?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial