Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
csjain1978
Starting Member
3 Posts |
Posted - 2013-05-09 : 03:08:52
|
I am new to writing sql queries and have a particularly complex query that I wish to write.It is essentially applying the Pareto Principle (80/20 Principle) to a set of sales data and update a column in each row of a table based on the business logic. The business logic is If a customer is among to 80% sales of a particular year then it is called High Volume else Low VolumeSimilarly for a product.It has been explained clearly with sample data in the excel sheet which you can find here : https://www.dropbox.com/s/7r2s5z0h1zcfnme/80%2020%20Sales%20query%20SQL.xlsxWill appreciate your help.RegardsChandra |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-09 : 04:46:14
|
Sounds like you need to use PERCENTILE_DISC() function to get the 80 % part and then use it to retrieve customers that are part of it------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
csjain1978
Starting Member
3 Posts |
Posted - 2013-05-09 : 05:45:42
|
VisakhWould appreciate if you could elaborate with an example. Chandra |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
|
csjain1978
Starting Member
3 Posts |
Posted - 2013-05-09 : 10:02:11
|
I saw that MIK_2008. Was not able to make it work and hence asked Visakh to elaborateChandra |
|
|
|
|
|