Order SSRS report column - reporting-services

I have a table in SSRS with a column which uses the expression
(Reportitems!Textbox71.Value / Reportitems!morCodeTextbox.Value)
This obviously divides one table filed by another and displays a percentage for each line.
I'm struggling to see how I can then order this percentage column to show the highest percentage in first row and then descending results. When I try and sort the table by going to table properties the available fields only include those from SQL query. Am getting errors when trying to use an expression to sort. Tells me that I can't use report items in sort expressions.
Does anybody know how I can achieve this?

you need to add a Sorting to table by expression: "(Reportitems!Textbox71.Value / Reportitems!morCodeTextbox.Value)"

Related

How to customize sorting based on Column in SSRS reporting

I have created report by adding parent group on column with data as "ALL","Non-GD","GD",MileStone",Total" and report is rendered as expected.
But one issue I am facing is with sorting,by default grouping is happening in Alphabetical order.How can I override the default and provide an expression in such a way the rows should be ordered
"ALL","Non-GD","GD","Total","MileStone".
Please let me know how can we create an expression on RecordType column with the order of rows shown above.
I tried with Group Sorting with below query and it worked.

Is it possible to Rearrange the columns in SSRS reporting services

I have a Matrix report in which the user can select a list of columns related to a particular table using a parameter. I need to rearrange the columns. I'm dealing with dynamic columns so i can't do it in designer mode.
I'm able to move & swap a single column by using two parameters one is to select a particular column we want to move and other parameter is to select a column that my desired column need to place after/before this column. For this I have created a Stored Procedure. It works fine.
Is it possible to rearrange multiple columns before viewing the report?
make the sort order of a the column group a calculated statement using the parameters to determine the sort order

Repport Builder - SSRS: How do you reference a value in column group

I have a dataset that is generating several columns when using the column grouping for one of the fields. Please see image below for example:
I need to add a additional column and reference the value in column CD for each row so that I could calculate the ratio of value for CD to Total for that row.
I have tried using
=SUM(IIF(Column2="CD",Column3,0)) which did not work. There must be some alternate way to referring to the column group which I am not aware of.
This works when an additional column is added off of the column group and not past the total column. When adding column, you should see the option of inside or outside the group. As long as you see that, you should be able to use the formula above and reference a column value.

In SSRS, how do I compare a value of a parent report item with report items in a child group?

I am using SSRS 2008. I have 3 different groups above my report details that are calculated sums. I am trying to color the limit red if any of the invoice sums(A) in a child group is above the limit(B).
I am currently using this expression, but it is only looking at the first or last invoice amount. The limit report item is in a parent group just above the invoice's group.
=IIF(ReportItems!Invoice_DueDate.Value>ReportItems!Limit.Value,"Red","Black")
My Solution: I decided to use SQL to get the sum of the invoice amount grouped by due date. I then called that field in the parent group.
If I understand your question correctly, then I think you can use
=IIF(MAX(ReportItems!Invoice_DueDate.Value) > ReportItems!Limit.Value,"Red","Black")
You need some sort of aggregate function, such as MAX() to tell SSRS what the scope and operation of what should be done. (For example if you wanted to make sure the total didn't exceed the limit, you would use SUM(...)
You can reference parent groups from a child group using aggregate expressions specifying the parent group Scope.
For example, say we have some simple data:
And a simple table based on this, with a group based on grp.
Here the BackgroundColor property for the value textbox in the detail row is set as:
=IIf(Fields!value.Value > Min(Fields!limit.Value, "Group1")
, "Red"
, Nothing)
This checks all rows in the parent group of the current row, not just the current row. This works as expected:
Without knowing your data it's impossible to say if this will work in your case, but hopefully it gives you something to consider.
Edit after comments
OK, based on further comments it seems like you need aggregate on aggregate functionality.
This is available via SSRS expressions in 2008R2 and above only, so this won't help in your case.
For older versions, your best option might be to add an extra field to your Dataset that supplies the maximum Invoice value for each group, and then you can use this value without issues in the parent group.
There are some workarounds around that suggest using custom code to do this, such as this post, but I've never used this suggested solution and would only even consider it if you don't have any control over the report Dataset.

Exclude hidden table row from total

I've created a table with a group filter so some values stay hidden.
However, the row that shows the sum() of the above values, still counts the filtered values.
Usually I would apply the filter to the query, but I'm also using this same dataset in other tables on the same report so that's not an option.
Am I missing something here, or is this a flaw in MS Reporting Services?
This appears to be a "feature" of SSRS, apparently because it calculates values in table headers and footers before rendering the detail section of a data table.
One way around this would be to add a derived Boolean column to your dataset (assuming your data source is SQL Server, using a CASE statement or similar) showing whether the row should be excluded from the table where the filter is required.
You can then change your table filter to check the indicator, and use a expression to carry out a conditional sum to aggregate the correct total. Something like
=SUM(Iif(Fields!ExcludeRow.Value = True,0,Fields!ValueToSum.Value))
It's more of a question than answer...
How to resolve this issue if you know whether the row is hidden or not ONLY at the Row Group level?
i.e. if you're filtering on the totals by this Row Group, i.e. you cannot have a field indicating if Row is excluded or not in a dataset.
ex: I have AR Aging report which has totals per months, patients. I need to filter out negative totals per patients (Patient row group), but I have column groups as well - per month, so my dataset cannot be per-patient granularity and therefore, the only place SSRS can decide whether to hide or show the row is on the Row Group level...
I had the same issue but I had too many column totals where to enter the Iif().
I resolved it by removing the filter from the group and putting the filter into the Tablix Properties dialog box (Select Tablix, Right-click the top left corner grey box and choose Tablixc Properties).