I have a stored procedure that returns the following data. The problem I am having is the business users want the report to group by week and sort in Descending order. Their company week is Mon-Sun and I was using ISO_Week to calculate the week, but I found that the week was then Sat-Sun. I have listed the results with Wk and ISO_week and you can see how the week order would give me funky order. I am sure it is simple, but I am having trouble wrapping my mind around how to do the sort order. Thanks!
WK
Location Dt Cust Ct Week
2 2016-01-01 122 1
2 2016-01-02 155 1
2 2016-01-03 157 2
2 2016-01-04 179 2
ISO_Week
Location Dt Cust Ct Week
2 2016-01-01 122 53
2 2016-01-02 155 53
2 2016-01-03 157 53
2 2016-01-04 179 1
It would help if you posted your query since I'm having difficulty discerning exactly what your question is. Is one of those result sets the correct one? Is your problem with the week calculation or simply ordering the results?