Visualise a 5 column dataset as show below. This is a very small sample of the actual dataset. It shows the date on which supplies were received for each item from Vendors and whether those supplies had errors in them. Finally those identified errors have been bucketed into relevant categories. The Item ID# is a code assigned by the Client Organisation. The format of the ID# is X [Last two digits of year of receipt] [Four digit Number]. For items received from a certain vendor, the last four digits of any item will always be in ascending order of the Date received. In other words. for items received from a certain vendor, the last 4 digits of an item received on 13 January 2017 will always be greater than the last 4 digits of an item received on 11 January 2017 from the same vendor. There will never be repetitions in the Item ID# column.
Vendor Name | Item ID# | Date Received | Error with Item? | Error Category |
California | X170016 | 1-16-2017 | No | |
California | X170014 | 1-13-2017 | Yes | Labeling Error |
California | X170015 | 1-13-2017 | Yes | Packaging Error |
California | X170008 | 1-9-2017 | Yes | Quality Issue |
California | X170003 | 1-2-2017 | No | |
California | X160645 | 12-26-2016 | Yes | Packaging Error |
California | X160646 | 12-26-2016 | No | |
California | X160644 | 12-25-2016 | Yes | Labeling Error |
California | X160638 | 12-20-2016 | Yes | Quality Issue |
California | X160633 | 12-15-2016 | No | |
California | X160626 | 12-8-2016 | No | |
California | X160625 | 12-7-2016 | Yes | Packaging Error |
California | X160624 | 12-5-2016 | Yes | Labeling Error |
California | X160618 | 11-23-2016 | Yes | Quality Issue |
California | X160613 | 11-13-2016 | No | |
California | X160606 | 10-30-2016 | No |
The objective is to compute the error rate by vendor and Error category for the 10 most recent transaction dates with that specific vendor. So, for vendor Name “California” and Error category as “Packing Error”, this ratio should be computed as = Number of packing Errors on 10 most recent dates/10.
Here is a simple snapshot of the Data for California. I have filtered the dataset where Vendor Name is California and then sorted the Date received column in descending order. Please note that when i filter the dataset on California, a lot more rows are returned. I am only showing the Top 10 rows here because that is what is important for solving this question.
Vendor Name | Item ID# | Date Received | Error with Item? | Error Category |
California | X170016 | 1-16-2017 | No | |
California | X170014 | 1-13-2017 | Yes | Labeling Error |
California | X170015 | 1-13-2017 | Yes | Packaging Error |
California | X170008 | 1-9-2017 | Yes | Quality Issue |
California | X170003 | 1-2-2017 | No | |
California | X160645 | 12-26-2016 | Yes | Packaging Error |
California | X160646 | 12-26-2016 | No | |
California | X160644 | 12-25-2016 | Yes | Labeling Error |
California | X160638 | 12-20-2016 | Yes | Quality Issue |
California | X160633 | 12-15-2016 | No |
The expected result is:
Row Labels | Labeling Error | Packaging Error | Quality Issue | Factory Error |
Boise | 30.00% | |||
California | 20.00% | 20.00% | 20.00% | |
Detroit | 70.00% | 30.00% | ||
Ekalaka | 20.00% | 20.00% |
I have solved this problem using the PowerPivot. You may download my solution workbook from here.
Perform an aggregation on Top x items after satisfying certain conditions
{ 0 Comments }