I am having to create a custom sort order within a SSRS Matrix, it returns 2 rows of data and then a total. When I add the custom sort order within the Row Group Sort Order, its moving the Total to the top and the relevant rows below it instead of keeping the total on the bottom, below is the code that I am using, can someone point out where I am going wrong, think the time of day is getting to me.
Thanks
=iif(Fields!loan_amount.Value="<£1000","1",
iif(Fields!loan_amount.Value="£1000+","2",""
))
In response to my follow on question, I cant post the entire output of the report as it contains company personal data so what I have done is go a screen grab of the Tablix in design view, this is currently meant to be ordering by revenue but when you look at the second screen shot you can see that this is not happening. I went through and checked the output of my stored procedure and its passing the revenue out as a decimal which is fine. I have just put the data in to a straight forward table with no grouping and then ordered it by revenue and it works fine, it appears to only happen when I am putting it in to a matrix. Any help would be much appreciated.
Try this as the sort expression:
=IIf(Fields!loan_amount.Value="<£1000",1,
IIf(Fields!loan_amount.Value="£1000+",50,99))
An empty string will sort to the top. Using numbers for a sort is more reliable. Leaving a gap between numbers allows you to add some other conditions in here later with a little less pain.
Hope this helps you out.
Related
report example
i have a report that displays client contact details, but annoyingly for each different contact type it displays the results on a separate line! Can anyone advise if it possible to show the results on one line using an expression or some sort of filter, not using SQL.
as you can see from the image Miss S has both a mobile (MBL) and telephone (TEL) number but they show on different rows, if in my program i were to add an email address then it would add a third line, is it possible to flatten the results down to one row?
regards
You'll need to remove the Contact Type column from the tablix as this won't be valid once you put all the contact details on the same row.
Once this is removed, you will then need to edit the row group (under the main design window) and group by the first 5 columns only. There may already be grouping set, if so check that contact type is not in the group by list, if it is remove it.
Alternative
After saying all this, I can't help but think this report would be a whole lot easier, assuming the data was structured correctly (it may already be), to use a matrix control. That way all this and the answer to your previous question (asked recently) would be automatic. I won't go into detail but if you are interested, create a new question and show the output from your dataset query, the query code itself and the desired output. optionally, accept this answer ! :)
I have 6 Datasets each one is the same query but has a different WHERE clause based on employee type. They generate 6 tables. At the top of the report there is a summary table which uses reportitems!textboxXX.value to grab the totals for 2 particular fields from all the tables. I'm also using a StartDate and EndDate parameter. Each reportitems! expression in the table comes from a different dataset in the report if that is relevant.
When I run the report using dates from yesterday back to the 9th of May I get the desired output.
But when I go to the 8th I get multiple rows all the same.
and as I go even further back I get even more rows of the same information. To my knowledge nothing interesting or different happened on the 8th of May and the tables further down the report look exactly the same. Any idea what might be causing this? The design view looks like this if that helps. There's no grouping or filters on the table.
Still not certain about the mechanics behind this but I found a 'solution' so I figured I'd post it. I just made a new dataset for my summary tables where the query was simply SELECT 1. Now I get a single row every time.
The goal is to take the data shown in the "SQL rows returned" portion of the image and display it in the "How report should look" portion of the image. It's currently being done using a sub-report that takes titleID, languageID, beginDate, and endDate as a parameters from the main report. However, it's really slow to run when a significant number or records are returned. My question is "Is there a more efficient way to accomplish the same thing in the main report w/o using a subreport?" If more information is needed to properly assess this problem, I'll be glad to add it tomorrow. Thank you!
Purely looking at the image.. all you need to do is put a tablix on your main report add a parent group of title_id..
Then delete the column that is created to the left (but NOT the group)
Right click on the detailed group -> insert row outside group. This will create a row inside the Title_id group but Outside the detail group.
In this line.. add the title ID, name etc.
The detail lines will show the details.. obviously.. You need to play around a bit to figure out the rest of it..
It looks to be a fairly straight forward report.. not sure why you need to use a subreport for this
I am stumped.
I have a select statement that returns the data fine in the data pane, but in the resulting report, one row is our of sort order and falls about 25 rows down in the data where it shouldn't be.
How do I trouble shoot something like that?
Thanks!i
Somewhere in the report you must be sorting the dataset. In this case, the data will look fine in the data pane but will be out of the expected order in the report. Try adding a brand new table to the report and apply the dataset. It should match the data pane.
How do I trouble shoot something like that?
You start by posting the select statement here so we can help without having to hone our psychic debugging skills :-)
It's possible that you're not ordering on every column you think you are. It's also possible that SSRS re-orders the data even after you've retrieved it.
They'd be the first two places I'd look.
I have an rdlc report file, and I am trying to make a sum which can only include the last item in each group. I have a table kind of like this:
Place = ? (Group header 1)
User = ? (Group header 2)
Date =Last(Fields!Number.Value) (Group header 3)
Number =Fields!Number.Value (Detail row)
So, in other words, in User there, I want a sum of Date... if that made sense...
The Numberrows contain many numbers per Date. But Date shows only the last number for that day, because the rest doesn't count (but must be displayed) In User I want to sum up those last numbers for all the dates for that user. And same with Place (which would be the sum of every last number for every day for every user).
Could anyone help me with this? I tried the obvious (to me at least) =Sum(Last(Fields!Number.Value)), but (also tried to specify the group in those functions, but didn't make a difference because) I get an error when I try to compile which says:
The Value expression for the textbox 'numberTextbox' contains an aggregate function (or RunningValue or RowNumber functions) in the argument to another aggregate function (or RunningValue). Aggregate functions cannot be nested inside other aggregate functions.
Which I guess kind of makes sense... but how do I do this then?
Update: I have solved the issue by adding another column, and copying those last numbers into that column. This way I can display all the numbers, and do the summing on the column that only contains the ones that is going to be in the sum. I am still very curious to if anyone have a solution to my original problem though... so please post an answer if you do!
Not sure I understand exactly what you're trying to do. Maybe something like =Last(Fields!Number.Value,"Group 1") + Last(Fields!Number.Value,"Group 2") + Last(Fields!Number.Value,"Group 3"), instead using a sum function?
the easiest way to do this would be to modify your dataset to only include the records your are displaying in the date field, that way you could just use a simple sum() instead of trying to do something weird and screwy and might not work.
Modifying the data set may really be the simplest solution, but if you really wanted to do this without complicating the query you could try "custom aggregation".
The exact techniques for this depend on the version of SSRS, and my understanding is it didn't really work that well before SSRS 2008.
The idea is, you write some custom code to maintain an array containing the last value for each date. One function updates the "last value" for a date, and another sums the values in the array. Your header calls the latter function; you conspire to cause the former function to be called once for each detail row before the header is processed.
Here's a blog with a write-up that explains the technique in SSRS 2008.
It also gives some insight into how you can try to make this work in SRSS 2005, but again apparently that's not as reliable.