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.
Related
I have a report with parameter to select the name and a textbox with expression field name. Below text box the a dataset table.
When I run the report, by default it will return all name on the table and HIDE text box.
When I select name in parameter, it will return for that name and SHOW text box.
I don't have any issue at this point.
BUT I do have problem that the textbox create a gap between header and the table WHEN I run the report by default (not select name in parameter).
My goal is to some how REMOVE THE GAP so the table can move up right below header. ONLY show when name is select on parameter.
You can do this as long as your table is not a matrix (as the column groups prevent you from merging cells).
Add a new row to the top of your table, then select all the cells in that row and merge them.
Now resize the single cell you just created so that it's roughly big enough to hold all the content.
Right-Click the cell and do Insert->Rectangle
Now either add new controls or copy and paste your existing ones into the rectangle.
Right-Click the row header and select "Row visibility", set it to the expression you are currently using to show/hide your text boxes.
That should be it. I did a quick test to try it out and it works perfectly (in this simple scenario). I've put some background colours in just to make it clearer but this is what the design looked like...
The row visibility was simply set to my parameter value =Parameters!HideTopRow.Value=1 . The textboxes in the yellow section are just some arbitrary values from the dataset.
When I run with the option set to 0 I get this..
When I run with the parameter set to 1 I get this.
I have a dataset like in the image below. I have used a Matrix in SSRS to unpivot the data.
What I have is like in the second image below. You will notice that percentage columns are at the far right. But what customers want is the name of a product followed by it percentage as seen in the last image. How do I accomplish this?
Add a blank tablix to your report, drag the agent field into it and go to row groups and add a group. Group it by the field agent. Now add next to the agent field in the tablix your phone field and afterwards the percentage field. Now your data is grouped by agents like in your image and the fields are were you placed them.
How would I set a maximum lines to display in a BO 4 report? On each page, I'd like to show 20 account numbers in column 1 with item counts in the next columns. There are some good discussions on limiting the rows retrieved in a query (e.g., Limit number of result or rows returned in BO using WebI). Some suggestions include using sections with RowIndex()/20 to limit the lines to 20, so I tried adding a variable =Floor(RowIndex()/20). However, the lines in my report contain aggregated variables, and the row index counts all records retrieved. Thoughts?
One option:
Add a column on the far left of the block. Use the following formula:
=Floor(RunningCount([Account Number])/10)
(assuming, of course, that your dimension is named [Account Number])
Create a break on this column. (Report Element -> Table Layout -> Break -> Add Break). Go back to the same menu and click Manage Breaks. Click the "Start on a new page" checkbox.
This will create a block with a maximum of 20 rows per page. Unfortunately, there's no direct way to hide a column in WebI, so you'd be stuck with this ugly column. What you can do, however, is remove all borders, change the font to white-on-white, and reduce its width as much as possible.
I have a report that I want add a line beneath the even rows in details section.I add a Line in details section and add this expression to that:
=IIF(RowNumber("DataSet1") Mod 2 , "Green", "No Color")
but line showed under the last record of my report.my report consist pf a simple table in details section. How I can show a line under even row number records?
The simplest way to display a green line under even-numbered rows in SSRS is to change the Details section row bottom border colour (via the BorderColor:Bottom property in the Proprties Window) to be an expression like the following:
=IIF(RowNumber("DataSet1") Mod 2 , Nothing, "Green")
(Note that in your original expression the colours were the wrong way around - so that the colour would be set green in odd-numbered rows, not even-numbered - and that "No Color" is not an acceptable colour in SSRS, so you would see warnings when previewing the output in BIDS.)
I have a report where I've specified the Columns property to 3.
I want the data I have from a single query to spread across these columns.
When I print the report however, I just get a single column that spans across multiple pages till the rows run out of data.
How do I tell rs that I want the data to wrap into the next two columns?
UPDATE: Ok, found a link on technet to give me a better explanation of multicolumns (e.g. newsletter style):
Multicolumn, newsletter-style reports
display report data down multiple
adjacent columns. A newsletter-style
layout applies to the entire report.
When you define more than one column
in a report, Report Designer
calculates the width of the columns in
the report, the width of the report,
and the width of the space between
columns based on the number of
columns. It then displays a reduced
design surface so that you can place
report items on the report that will
fit within the column. Note that the
layout of the entire report must be
placed on the reduced design surface.
Additional columns are displayed so
that you can verify that the number of
columns you defined will fit the page
size dimension. You can adjust page
size, padding, and margins to fit more
columns on the page.
Only PDF and Image renderers support
newsletter-style reports.
I still haven't quite figured out how to make the column wrap...but I'll look into it further on Monday.
I addressed my issue by:
Putting 3 Tablix in my SubReport
Adding a Count Aggregate in my SQL results
Doing % calculations in the Tablix filters
For example, Tablix one has a filter formula like this:
=IIF(Fields!MaxRowNumber.Value <= 10, 10, Fields!MaxRowNumber.Value * .4)
So, if only ten rows are returned, display those ten rows in column 1. If more than ten rows appear, then put 40% of the results in Tablix 1.
I do similar calculations for Tablix 2 and 3 to display the 30% in each Tablix respectively.
Feels like a bit of a hack...but it works.
So one approach is to use multiple tablix with a filter that checks RowNumber and accordingly displays particular records in each table.
The other way is called Newsletter-style report (link). This formatting is retained only when report is exported as PDF or Image. It can be previewed only when you select 'Print Layout' on the Preview tab in Visual Studio. Here is an example:
Create a new report with the foll. dataset: SELECT ID,NAME FROM TABLENAME
Add a new table to the report and select the ID and Name as columns
Click on the tablix and press F4 to edit the tablix properties. In the properties window, change the Size - set the width to 2in
Click on the report area outside the report page boundary and press F4 to edit the report properties. In the properties window, change the Column value to 3, and column spacing value to 0.1
On the report scroll to the right hand side, you will notice that there are 2 new columns (so totally 3 columns on the report - because you selected 3 in step 4 above). Now click on the margin at the start of the column 2 and pull it further to the left to bring it as close to the column 1. This is only to reduce the need for huge page size.
Right click on the report area outside the report page boundary and select Report Properties. Change the Page Size - Set the width to 10in
Preview the report. Now select the 'Print Layout' tab to see the result. This formatting is retained only when report is exported as PDF or Image.
As noted in points 5 and 6 - since the report body flows into multiple columns, you must ensure that the page size is at-least equal to -> ([Original report body size times the number of columns] + all the column spacing values). Otherwise it will look messy.