I'm running sparkline reports and charts in SSRS have been nothing but a pain to work with for me. I'm trying to run a 1-year from today sparkline - the query groups the data by month, but I want it to sort descending by the most current date - so it would read 1-2014, 12/2013.. and back
SELECT DATEPART(month, Orders.OrderDate) AS month, COUNT(Orders.OrderID) AS Count, SUM(Orders.GrossSubtotal) AS GrossRevenue, SUM(Orders.Subtotal) AS Revenue,
SUM(Orders.OrderCost) AS Cost, SUM(Orders.Subtotal) - SUM(Orders.OrderCost) AS Margin, SUM(Orders.Subtotal) / COUNT(Orders.OrderID) AS averageOrder
FROM Orders LEFT OUTER JOIN
Campaigns ON Orders.CampaignCode = Campaigns.CampaignCode CROSS JOIN
PK_StatsCurrentDatesCMP
WHERE (CONVERT(date, Orders.OrderDate, 103) BETWEEN PK_StatsCurrentDatesCMP.[1_YearRoll] AND PK_StatsCurrentDatesCMP.EndDate) AND
(Orders.SuppressFromStats = 0) AND (Orders.Void = 0) AND (Orders.WholesaleOrder = 0)
GROUP BY DATEPART(month, Orders.OrderDate)
ORDER BY month DESC
right now with ordering by desc it just gives me 12,11,10...