I am having trouble building a measure to accomplish what's described below.
I am working with the following scenario:
- There are 2 types of balls: green and red.
- There are 3 types of buckets: A, B and C.
The balls are randomly dropped inside the buckets. The table below shows how many balls are inside each bucket:
<tbody>
</tbody>
Now, the table below shows how many balls, by color, should be removed from the buckets:
<tbody>
</tbody>
The balls should be removed from the buckets starting from the lowest ranked bucket for each ball color.
Below is the rank of each bucket by ball color:
<tbody>
</tbody>
The table below shows how the final result looks like after the balls are removed starting from the lowest ranked buckets:
<tbody>
</tbody>
Explaining the case of the green ball: the Bucket-A is ranked lowest (rank = 3) among the 3 buckets and the quantity in the Bucket-A dropped from 1 to 0. Then the Bucket-B (rank = 2) had its quantity lowered from 2 to 1. Result: total of 2 green balls removed.
Question: Is it possible to build a measure to give me the results showing in the table above? Basically I need a measure to calculate the quantity of balls to be removed from each bucket according to their rankings by ball color.
------------------------------------
These are the tables I am working with:
Table: Remove
<tbody>
</tbody>
Table: Quantity
<tbody>
</tbody>
Table: Rank
<tbody>
</tbody>
The tables "Remove" and "Quantity" are linked by the column "Ball_color".
The tables "Quantity" and "Rank" are linked by the column "Line_ID".
Any help is appreciated. Thanks.
I am working with the following scenario:
- There are 2 types of balls: green and red.
- There are 3 types of buckets: A, B and C.
The balls are randomly dropped inside the buckets. The table below shows how many balls are inside each bucket:
Ball_color | Bucket-A | Bucket-B | Bucket-C | Total |
Green | 1 | 2 | 1 | 4 |
Red | 2 | 3 | 1 | 6 |
<tbody>
</tbody>
Now, the table below shows how many balls, by color, should be removed from the buckets:
Ball_color | Remove |
Green | 2 |
Red | 3 |
<tbody>
</tbody>
The balls should be removed from the buckets starting from the lowest ranked bucket for each ball color.
Below is the rank of each bucket by ball color:
Ball_color | Bucket-A | Bucket-B | Bucket-C |
Green | 3 | 2 | 1 |
Red | 1 | 2 | 3 |
<tbody>
</tbody>
The table below shows how the final result looks like after the balls are removed starting from the lowest ranked buckets:
Ball_color | Bucket-A | Bucket-B | Bucket-C | Total |
Green | 0 | 1 | 1 | 2 |
Red | 2 | 1 | 0 | 3 |
<tbody>
</tbody>
Explaining the case of the green ball: the Bucket-A is ranked lowest (rank = 3) among the 3 buckets and the quantity in the Bucket-A dropped from 1 to 0. Then the Bucket-B (rank = 2) had its quantity lowered from 2 to 1. Result: total of 2 green balls removed.
Question: Is it possible to build a measure to give me the results showing in the table above? Basically I need a measure to calculate the quantity of balls to be removed from each bucket according to their rankings by ball color.
------------------------------------
These are the tables I am working with:
Table: Remove
Ball_color | Remove |
Green | 2 |
Red | 3 |
<tbody>
</tbody>
Table: Quantity
Ball_color | Bucket_ID | Line_ID | Quantity |
Green | Bucket-A | Green-A | 1 |
Green | Bucket-B | Green-B | 2 |
Green | Bucket-C | Green-C | 1 |
Red | Bucket-A | Red-A | 2 |
Red | Bucket-B | Red-B | 3 |
Red | Bucket-C | Red-C | 1 |
<tbody>
</tbody>
Table: Rank
Ball_color | Bucket_ID | Line_ID | Rank |
Green | Bucket-A | Green-A | 3 |
Green | Bucket-B | Green-B | 2 |
Green | Bucket-C | Green-C | 1 |
Red | Bucket-A | Red-A | 1 |
Red | Bucket-B | Red-B | 2 |
Red | Bucket-C | Red-C | 3 |
<tbody>
</tbody>
The tables "Remove" and "Quantity" are linked by the column "Ball_color".
The tables "Quantity" and "Rank" are linked by the column "Line_ID".
Any help is appreciated. Thanks.