Hi @Wesley Butler ,
Sorry, your description is not clear enough for me. What is your expected output? Here is what I am currently trying:
CREATE TABLE #test(DATEVALUE DATE,TRENDSTATUS INT)
INSERT INTO #test VALUES('2021-01-01',199)
,('2021-01-02',252)
,('2021-01-03',303)
,('2021-01-04',377)
,('2021-01-05',480)
,('2021-01-06',512)
,('2021-01-07',522)
,('2021-01-08',449)
,('2021-01-09',329)
;WITH cte
as(SELECT *,DENSE_RANK() OVER(ORDER BY TRENDSTATUS) rr
FROM #test)
SELECT *
FROM #test t
JOIN cte c
ON t.DATEVALUE=c.DATEVALUE
ORDER BY t.DATEVALUE
Output:
rr is the ranking of the daily value.
If you have any question, please feel free to let me know.
Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.