SQL Server Report Builder - Expression to Sort Value to Bottom of Column

173 Views Asked by At

Is there a way or expression for me to sort a value to the bottom of a list in MS SQL Server Report Builder 3.0? I have a column named Project Names and a value named "Resource". There are about 20+ Project Name values. Is there an expression I can use to sort the field!ProjectName.Value so that the Project Name "Resource" appears at the bottom of the column instead of in the order A to Z? Thanks!

3

There are 3 best solutions below

1
On

How about making a new column SortOrder that has the following expression:

IF(field!Projection.Value<>"Resource",field!Projection.Value,"zzzResource")

Just make the column invisible on your report.

0
On

Rather than do this in ReportBuilder, I would consider creating a 'sequence' column in the sql that uses:

CASE WHEN ProjectName = 'Resource' THEN 0
 ELSE 1
END AS SEQ

Then you could sort on the sequence column. field!SEQ.Value

0
On

I was able to accomplish the desired sorting by creating a new column ProjectSort in my dataset where Project Names that = "Resource" was renamed "ZZZZZ". The new column ProjectSort was applied to the Row Group ProjectName via Group Properties > Sorting > Sortby > ProjectSort. Thanks for the idea!