| ID | OfferBy | Amount offered (€) | 
| 1 | Samsung | 100 | 
| 1 | Apple | 125 | 
| 1 | Nokia | 250 | 
| 1 | Blackberry | 300 | 
| 2 | Apple | 150 | 
| 2 | Nokia | 220 | 
| 2 | Blackberry | 240 | 
| 3 | Nokia | 300 | 
| 3 | Apple | 150 | 
| 3 | Blackberry | 100 | 
| 3 | Samsung | 50 | 
and this would be divided by the sum of all offers.
For example, because ID 1 has both offers from Samsung and Apple, it meets my condition and the sum of offers from Samsung and Apple (100 + 125) would be added to the numerator. ID2 wouldn't be taken into account because only Apple has made an offer but Samsung hasn't. ID 3 would be added to the numerator because it has offers from both Samsung and Apple (150 + 50).
This would be divided by the sum of all offers.
Any help would be appreciated
0 Response to Generating variable based on each ID's
Post a Comment