I need help with automating a process in SQL Server. I want to use a loop to exclude certain records.
- Calculate the impact of each record to the “Average Selling Price” in the attached excel file.
- For example, If you were to exclude the Aguirre purchase of SKU A in the US, what would be the “Average Selling Price” for A in the US?
- Additionally, after itinerating over the 4 transaction for SKU B in the US, what is the ranking of each transaction regarding the impact to the ASP?
country | sku | customer | units | sales | unit price | Average Selling Price |
us | a | aguirre | 10 | 100 | 10 | 15.55555556 |
us | a | wirt | 100 | 2000 | 20 | |
us | a | emrich | 3 | 50 | 16.66667 | |
us | b | aguirre | 34 | 100 | 2.941176 | 9.190627744 |
us | b | wirt | 67 | 2000 | 29.85075 | |
us | b | emrich | 34 | 50 | 1.470588 | |
us | b | jory | 20 | 50 | 2.5 |