I have a report with the number of attendees by month shown and rows grouped on an "Attended" or "Did Not Attend" Attendance_Indicator flag (this in itself is a sub-group of a higher level of grouping).
For legibility I wanted any row of Attended data with a coloured background (say LightGrey) and any other rows transparent.
I have highlighted the cells within the table at this grouping level and used the expression below:
=IIF(Fields!Attendance_Indicator.Value = "Attended","LightGrey","Transparent")
This partial works in that where the count of attendees is >0 the cells' background colour changes to grey. However, in cells where the count of attendees is 0 the background remains transparent.
Can anyone advise how I can get any cells, whatever the count value, on the Attended row to change background?
IsNothing is your friend here. You may need to fiddle with the logic for your colours (e.g. NOT IsNothing rather than IsNothing)... but you get the idea.
=IIF(IsNothing(Fields!Attendance_Indicator.Value) OR Fields!Attendance_Indicator.Value) = "Attended","LightGrey","Transparent")
Related
I have a basic Tablix in my report that currently renders as follows:
These are steps in a manufacturing process with the clock number of the person who performed them with date performed in the last two columns. However, sometimes steps are combined and performed together. In the example above, steps 10-20 are performed together, and 30-40 are performed together. So I would really like the report to be rendered like this:
I do have a column in my data called "StepRange" which in the above example would be "10-20" for the first two rows and "30-40" for the third and fourth rows. So when the value of StepRange is alike, I know those rows are performed together and henceforth the last two columns should be combined. My example shows only two rows being combined at a time, but it could be any number.
How can I make my report look like the second example above instead of the first?
Single Tablix Method
Rather than literal conditional merging, you can set the border style of a textbox using an expression to achieve a similar effect. There are a few steps, but none of them are particularly involved.
Create a parent group for StepRange. Do not add a header or footer, and delete the added column without removing the group.
Make sure that your properties panel is visible on the right of your screen. If not, check the "Properties" checkbox under the View ribbon.
Click on your first detail TextBox and expand the "BorderStyle" property. Set the "Top" property to the following expression:
=IIF(RunningValue(Field!Step.Value,CountDistinct,"StepRange")>1, "None", "Solid")
Set the Bottom property to "None".
Set the expression of the detail TextBox itself.
Replace FIELDNAME with the appropriate field:
=IIF(RunningValue(Field!Step.Value,CountDistinct,"StepRange")>1, "", Field!FIELDNAME.Value)
Repeat this process for each detail TextBox.
You may need to create a dummy row at the bottom with a black top border if you do not have a summation row. (optional)
The expression only evaluates to "Solid" for the first Step value within each StepRange group, so subsequent rows do not have a top border and appear undivided.
Nested Tablix Method
Using a nested Tablix is more straightforward. I have had some issues with them, including some rendering hiccups. But in a report this simple that may not be an issue at all.
Set up your main Tablix to group on StepRange.
Either clear or add a column to the left for the individual steps.
Select "Insert Table" from the toolbar and click on the empty cell.
Set the cells to your step and operation fields and delete the extra column.
The result should look roughly like this:
By default the inner Tablix will be detail grouped. If your detail rows are more granular than the "Step" field, go to the properties of the "(Detail)" group and add a Group Expression for Step.
You can also delete the inner header row if you don't want to see it repeated in the report.
This results in the employee fields actually being merged and spacing properly. If you don't use an aggregate function on those fields, their value will be that of the first row returned internally. Which is moot if their values are uniform across steps.
I have a report that uses grouping in SSRS. The group is collapsed on load and when I expand each group, I can see the individual records. I have a field for each row that shows if its an "Error" and "Info". I did give a different background color for the row like this
= IIF(Fields!Loglevel.Value = "ERROR", "Maroon", "NoColor")
and it shows me erros with a different background color.
But what I am trying is to give the whole group a background color if there is at least one error inside it. Can anyone suggest me a way to do this? I tried for backgroup color for the group and I don't see it. Please suggest a way!
Thanks
You need to sum up when Loglevel.Value = "ERROR" using an IIF statement, but you need to do it for the SCOPE of your group.
The scope is the name of the group, eg tblMain_Group1, or whatever you entered when you created the group
Then use that as the criteria for your background colour for the data row
=IIF(SUM(IIF(Fields!Loglevel.Value="ERROR",1,0),"tblMain_Group1")>0,"Maroon","Transparent")
I'm looking to do banded rows in SSRS.
I've Googled it but only seen examples of it in a table Report not a tablix with multiple groupings.
Lets say I have a dataset
Employee..............Product.........Date...............Amount
Jose..................TV..............2013-12-01.........150
Jose..................TV..............2013-12-02.........100
Jose..................Stereo..........2013-12-01.........50
Jose..................Stereo..........2013-12-04.........100
Jose..................Camera..........2013-12-02.........400
Brad..................TV..............2013-12-03.........100
Brad..................TV..............2013-12-04.........50
Brad..................Stereo..........2013-12-03.........100
Hector................Stereo..........2013-12-04.........50
I want to make a report that looks like
Employee.......Product.......2013-12-01....2013-12-02....2013-12-03....2013-12-04
Brad...........Stereo....................................100
...............TV........................................100............50
Hector.........Stereo...................................................50
Jose...........Camera......................400............................
...............Stereo........50.........................................100
...............TV............150...........100
I wanted to do banded rows.
Let's say
Brad's Stereo line is Blue
Brad's TV line is Green
Hector's Stereo line is blue
Jose's Camera Line is Green
Jose's Stereo Line is Blue
Jose's TV line is Green
The rownumber trick doesn't work because the rows come no particular order
and in the case of Jose's stereo line, the cell under 2013-12-01 and 2013-12-04 would have different values.
I saw a trick using running values and count distinct, but that won't work either.
Anyone have any ideas how to do banded rows in SSRS using a matrix/tablix?
I'm assuming you are starting with a matrix that looks like the image below: two row groups and one column group.
Right click on the row group for Product and choose Add Group -> Child Group. In the Group By box enter "1".
Rename the group to RowColorGroup. Rename the textbox (in the details row to the right of textbox contining the product field) to RowColorGroupTextBox.
Select the value for RowColorGroupTextBox by entering the following as the Value expression: =iif(RunningValue(Fields!Employee.Value & Fields!Product.Value,CountDistinct,Nothing) Mod 2, "LightSteelBlue", "White") (You can change the colors to whatever you want.)
In the textbox properties for RowColorGroupTextBox change the fill color expression to =Value
Remove any text in the header field above RowColorGroupTextBox.
Remove the right border on the textboxes in the column containing RowColorGroupTextBox.
Remove the left border on the textboxes containing the date field and the amount field.
Set the width of the RowColorGroupTextBox to 0 and the CanGrow property to false.
Select the textbox containing the amount fill and set the fill color expression to =ReportItems!RowColorGroupTextbox.Value
This results in a report where the details rows alternate in colors.
Here's a blog post I found that uses the same method.
Is there a way to determine when a Grouping has changed in SSRS 2005?
For example, if you are grouping on OrderID, displaying the Order Header info, and the details are the Order_Items etc... Is there an event to check for to tell when the "new" OrderID has appeared?
Are you able to somehow compare the current OrderID to the previous OrderID in the group?
I have multiple groupings in a report, and this group in particular is the 3rd group, and on the Grouping change, I want to make the border of the Group Header solid. There are certain occasions depending how the groups change, the boarder is left as "None" and it looks odd in the report.
Edit: (Here is an Image Example)
I have managed it so far by adding an additional row to another grouping, and making the row height .03125. It gives off the desired appearance, but I thought there was a way to tell when the grouping changed. Maybe grouping row number = 0 or something?
Theres not really an event, but you should know that when you create a group you can include a group footer within the group. The groups details ends once it hits the footer of the group.
I personally like to use this to create row border style (bottom) with a line to get a nice effect allowing me to see when the group is complete.
Something to this effect:
I have a report with a tablix. In the Tablix I have 2 Column Groups, the first level in the Column Groups is "Continent" and the second level is "Country". Now the users want to have different background colors depending on the value in the "Continent" group so that all Asian Countries are green and all European Countries are blue. This works fine as long as a cell has a value. However sometimes there is no record for that in the database therefore a cell on the tablix stays empty.
Is there a way to find out to which Column Group such an empty cell belongs to use this information in the formating expression ?
moontear is on to something, it may be easier to change the query to always return a result for every combination.
You can get what you're after directly in RS tho. If you add another cell to your tablix to force RS to calculate a result for the intersection of the two columns then you can use Fields!Continent.Value. i.e. if you add a cell that is =count(Fields!Continent.value) then it'll return 0 and you can then have an expression like =iif(Fields!Continent.Value=1,"Red","White")
You'll then want to shrink the column down to 0 width and hide it so it doesn't get seen in the final output.