Groups | Blog | Home
all groups > sql server reporting services > october 2005 >

sql server reporting services : Column Order in Matrix


del
10/25/2005 4:56:03 PM
Using SRS 2000.

When creating a matrix report, can you order the columns? By default, they
are in alpha order. My columns are the months of the year. Using Order By
in the query doesn't work.

Robert Bruckner [MSFT]
10/25/2005 8:57:39 PM
If you have an actual DateTime field in the dataset, you could just add a
sort expression on the matrix column grouping like
=Month(Fields!SalesDate.Value)

If the column groupings are just based on a string field that actually
contains the month names and there are no other fields that would provide
full datetime information, you could create some "faked" datetime object
based on your month string and then use a sorting expression like
=Month(DateValue(Fields!MonthNameString.Value & " 1, 2005"))
See also:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctmonth.asp
http://msdn.microsoft.com/library/en-us/vblr7/html/vafctDateValue.asp

-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

del
10/26/2005 9:12:18 AM
Thanks for that. That converts the string to the month number, but it
doesn't sort them 1,2,3... It's still in the same order, but with numbers.

I thought I was being smart by converting in the query using datepart and
datename.

I will look through the info you gave.

[quoted text, click to view]
del
10/26/2005 12:31:02 PM
Here's what I did:

In the query, I used date(mm,field) to convert the date in to a month. Then
In the matrix report, I sorted by order and used the monthname function. So
after it was sorted numerically, I used the expression,
=monthname(Field!....Value) and it returns the name of the month.

I would have never looked if you hadn't pointed me in the right direction.
Thanks!

[quoted text, click to view]
AddThis Social Bookmark Button