rank variation

Database

rank variation

Hi.  Hoping you can help me with another issue.  I have some data similar to that shown below, and would like to rank the states - 1-50 based on their sales totals.

cust,state,sls,State_Sls_total,desired results,observed results

a,MN,1,6,2,5

b,MN,2,6,2,5

c ,MN,3,6,2,5

d,WI,1,10,1,1

e,WI,2,10,1,1

f,WI,3,10,1,1

g,WI,4,10,1,1

I can get the State_sls_Total using the following query, but the State_Rank, gives me what is observed above, rather than the desired results.  After reading the manual, I now understand why I get the results I do.  I am pretty sure I can use a sub-query, but with over 700K records and a join of 7 tables, I was hoping I could use one of these analytic functions to improve my performance.

SELECT

cust, 

state, 

SUM(sls) OVER (PARTITION BY State) AS State_SLS_Total,

RANK() OVER (ORDER BY State_sls_total DESC) AS State_Rank

FROM sls_table

Any suggestions?

Thx

John

- using teradata 13.10