SSRS Reporting error in Total - sql-server-2008

I have Developed a new SSRS report. I added a new tablix in it and in that tablix added two columns called "Total Incidents logged" and "Total Security Incidents logged".I gave row visibility and mention the following expression.
=iif(Fields!SecurtiyIncidents.Value = 0,true,false)
So i hide those rows in which values of security Incidents contains 0. But the problem is, in total column of Total Incidents logged, it contains the hide values also. I googled and found only those answers which contains only one Column and people gave row visibility. But in my case there are 2 columns.
For better understanding, i have added images. In first image, the normal table is there with total
in second picture, given row filtration on Security Incidents Logged, i.e =iif(Fields!SecurtiyIncidents.Value = 0,true,false)(So i hide those rows in which values of security Incidents contains 0) but if you see total of Incidents logged, it not changed. :(
Could anyone please help me out?

You are putting two different values in one row.
You are telling SSRS to hide that row if one specific value in that row is zero.
When that value is zero, the whole row is hidden and you are wondering why?
Either put the values in different rows, set the column visibility using your expression above or simply set the value of the text box to be =iif(Fields!SecurtiyIncidents.Value = 0,"",Fields!SecurtiyIncidents.Value)

Filter the tablix:
Fields!SecurtiyIncidents.Value <> 0
Hiding the row only modify the display, the calcs/totals remains normal.

If you are hiding each row that has zero values in one or both fields you can use a conditional SUM in the total row as follows.
For No of Incidents Logged column use:
=SUM(IIF(Fields!SecurityIncidents.Value>0,
Fields!IncidentsLogged.Value,
0))
For No of Security Incidents Logged use:
=SUM(Fields!SecurityIncidents.Value)
Let me know if this helps.

Related

SSRS - Merging cells of specific columns

I am developing a complex report in SSRS which should like below
Screenshot 1
output returned by stored proc have multiple rows of one User ID and based on that columns "Successful Orders -- Online - Total Orders", "Successful Orders -- Online - Total Amount" & likewise Retail - Total, Other - Total columns cells should be merged based on respective User Id.
I have used tablix control and tried adding grouping over columns which needs to be merged but it is not working as expected. in order to group I am setting Sum of returned Value in cell but yet no luck.
Can you please provide me some pointers in order to achieve whats expected. please let me know if you need more information
output after adding nested tablix
ScreenShot 2
also, distorted output with inner tablix. borders are causing issues
ScreenShot 3
Try placing a tablix in the cells containing the multiple rows to display them. Basically, you need to switch your approach from "How do I merge these cells?" to "How do I split these cells." Set up your grouping at the level you want your totals and then in each of the columns where you want the details displayed, add a tablix to display the details. You'll need to play with the grouping a bit to get it display correctly.
More details:
The sample you provided above should be one group level row, not multiple detail level rows. Add your group to that Tablix and the summaries you want for your Total columns. Then Merge each of the "Mode" and "Count" column pairs and insert a Tablix into that merged cell with the same grouping as the row with the Totals, but with only the Details row displayed (don't add group header or footer and delete the blank row and summary column that automatically gets added). Now just set your field values for Mode and Count and adjust your column widths to match the headings.
Here's a REALLY simple report that displays a Plant and the employees associated with that plant. This is the top level where you Totals group would go. The next image is the "inner" part, where you would add in another Tablix with the same group(s), but only the details displayed.
This is super simple example and you may need to include additional levels of grouping to match your report, but the fundamentals still the same - an "outer" Tablix with an "inner" Tablix with matching group(s).
There's a lot you can do with this approach by manipulating the groups, hiding/displaying different groups or even hiding the details and displaying subtotals.

How to incrementally number report details and set 0 if no records, Access Reports

I have an Access report with details (see image below). I have incremental numbering for the report details. I achieved this by creating a TextBox and setting it's Control Source: '=1' and Running Sum: 'Over Group'. This works well, but if I have no records the number shows up as 1 (I want this number to show up as 0). If I try to check if detail is NULL in VBA, it returns false if I have at least one Detail record in the entire report.
(Try 3)
OK, so the red section does show up on a left join, because the query is returning Null for the missing records.
So, your real fix is to:
Select a detail field that that is always non-Null (I'll assume it is called ID)
Set the control source of your counter control to:
=IIf(IsNull([ID]),0,1)
That way the running sum will show zero for emply detail groups.

SSRS 2012 - Hide table row containing a subreport with no data

I have a table with a details grouping containing two rows. The top row is several cells across with details on the data, and the bottom row is all columns merged to one cell, and that cell contains a subreport. This subreport has one parameter, which is the value of a cell in the top row. What I need is, when the subreport does not have any data to display for a particular value, for that row to not display at all. Right now it displays as a blank row between its top detail row and the next detail row. I can get it to display a "No Rows" message, but I don't want that, I just want it to not take up any space, ie the detail row would just be followed by the next detail row. I've found several similar answers like this: How to supress empty subreports in SSRS 2008, but as I said I need to NOT have a No Rows message. Thanks in advance
I 'think' the only way you can do this is to query the data from the main report and if no rows are returned, hide the row. If the subreport is a simple query then this should be OK but if it's a long running query then this will effectively double the execution time.
You have not given any clue as to the content of the subreport but if it was say, invoice lines for the invoice shown in the main report row then you might be able to modify your main dataset to include a count of records that would appear in the subreport and use that value to control the row visibility.
If this makes not sense, edit your question and post a screenshot of what you are trying to achieve and/or post a sample of the data that you are getting from both the main report and your subreport.
One simple way that worked for me was as follows:
Select the row that will contain the subreport. Set the CanGrow and CanShrink properties to true. Insert the subreport into the row. Under SubReport Properties > Visibility > Show or hideā€¦ and add the following expression:
=IIF(RowNumber(Nothing)>0,False,True)
Then select the row again and use the handles to make the row as small as possible or as small as you like. When you run the main report the subreport will appear if it return records, otherwise the row will be blank and the height will be what you set above with the handles.

Hide Multiple Columns in SSRS Matrix

I have a Matrix report with some columns that are grouped by Month and Year in the Column Group. Now, these columns are being toggled by the Month Column as the Visibility Property is set to hide but toggled by the Month Column. But when the report is rendered, the hidden columns come out as blank and this defeat the purpose of the report, as seen in the images below. How do I do away with the blank spaces or which is the best way to meet this requirement?
I'm assuming you tried to set the individual column visibility properties...
You actually need to set the group visibility of your EnglishMonthName group to be toggled by [CalendarYear]. This will not hide the column completely (as you would not have anything visible to click on to get it back again) but it will collapse the data down and aggregate at the year level.
What you have done to hide your columns is actually working.
If you look at that WIDTH of each of the month then you will see they are of the same width. So according to your query you have the months appearing regardless of the corresponding data for that month.
I would do in two way depending on how the users would like it.
If possible and for better performance, I would alter the SQL query and do one of the following:
1. The months for which there is no corresponding data - I would remove the month names (or ID) as well
2. Rather than returning NULLs I would return a valid value like 0 or 'N/A' this will how the month as well as what the data actually is
To do it in the matrix you will need to alter the visibility of the month row as suggested by Alan Schofield

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