SSRS Grouping by value ranges: change scope when selecting value - reporting-services

Currently developing a report that groups items by value range. Using fictional data to describe the situation:
I'm trying to get this desired output, but I cannot use aggregate functions (Sum, Avg) when grouping items. Is there any way to group the ranges on the parent (order) level while retaining the child (order line) data? Any help would be appreciated.
Currently when I try to sum up the data, the sum of the order line is used (which is equal to the value and of no use to me).

I would do this at the dataset level. Either by using a separate dataset with Order Totals and the SSRS 2008R2 lookup function or by adding an Order Total column to the current dataset.
In these you could either get the group value ("1 to 10", "11 to 20"...) or the actual order total and create the grouping in the Group By formula in the SSRS group.

Related

Sorting in Tablix Computed Column

Friends,
I am using Tablix Control in RDLC to generate matrix report. In the last column of my matrix (group) report I have defined a formula using expression Now my user want to sort this column by ascending or descending.
(Criteria will be sent to report via Report Parameter).
I found sorting under Row Group - > Group Properties -> Sorting.....
But I am not sure how to do sorting on column which is calculated based on formula.
How can I do that? Can any one tell?
New answer:
If you do not need to use a parameter for triggering this sorting, then Interactive Sorting would accomplish exactly what you are looking for. Right click on the header of the column in question and you should see Interactive Sorting.
If it needs to be a parameter for whatever reason, then it would depend on the data type. If it is some kind of numeric type, then you could have the parameter value be either 1 (ascending) or -1 (descending). You would then sort on the parameter multiplied by the expression for that column.

Sum/Running Total of Expression in a Group

I have been racking my brains all day trying to research and figure out how to sum an expression in a group in a tablix. Here is the basic setup:
I have a parent group called "Type", and within that is a child group called "CostCode". I am hiding the details group underneath CostCode because it has individual transactions I don't need to see. So the visible data on the tablix is aggregated in the group header. In the CostCode group, I have a column with an expression that calculates a Projection figure for each header line of CostCodes using a group variable within the CostCode group.
In the Type group footer, I just want to calculate the sum of those projected figures like a subtotal. However, the aggregation and the way I've done this is making it confusing to me. Does anyone know how to do this?
Attached is a picture example of what I have going on. Again, just trying to sum the Projection column of which the values are from an expression:

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.

How to I get cumulative monthly subtotals in SSRS?

I'm using SSRS to create a report which shows a lot of transactions according to a trade date. I've made a group on the month and year called 'grpMonthYear'. Inside that group I've made a subgroup on 'TradeDate'.
The groups and all work perfectly. I'm also generating monthly subtotals in the footer of the group 'grpMonthYear'.
But now I want the cumulative subtotals.
Example, if Jan'13 totaled up to $5,000.00 and transactions in Feb'13 totaled up to $7,000.00 So the monthly subtotal in Feb'13 should show me $12,000.00
I tried using
RunningValue(Fieldname,SUM,'grpMonthYear')
But it doesn't work.
Am I missing out something?
You need to set the scope in the RunningValue function to one outside the current group, for example the table's DataSet itself.
So something like:
RunningValue(Fieldname,SUM,"DataSet")
Here's a simple example based on the following data:
I've created a simple report grouped by grpMonthYear:
The Month Total is just the sum in the current group scope.
The Cumulative Total expression is the following:
=RunningValue(Fields!tradePrice.Value, SUM , "Trades")
Where Trades is the DataSet name. This now gives the required results:
So hopefully this helps - just keep the ordering of all the elements of the table in mind as well as the specific parent scope to use if there are nested groups.

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).