How to fix the gap after hiding a column in SSRS 2008 - reporting-services

That might be simple but I couldnt solve it for hours.
I use Microsoft Reporting Services 2008 R2 and ReportViewer 2010. I have a table in one of my reports having three columns like:
Name Age Gender
Jack 20 M
What I want is to hide Age column based on a parameter. I am doing it by giving it an hidden expression like:
=IIF(Parameters!check.Value=1,true,false)
However, when the column becomes hidden the output is:
Name Gender
Jack M
THere is a gap between name and gender now. I need to have an output like
Name Gender
Jack M
without gap. I couldnt manage to provide it. Any help would be appreciated.

It should work if you select the entire column, right click and go to Column visibility... menu then set that expression in the Show or hide based on an expression textbox.

Related

Use Top n on category group in chart

I have a report showing a table showing details, it has about 380 rows.
I want to add a simple bar chart using the same dataset.
In the chart is one value and one group: value = sum(amount) and category group = description order by sum(amount).
This is working fine, but chart is showing about 120 bars, because of 120 distinct descriptions. I only want to display the top n.
Can this be done in reporting services itself or do I need to do this is a query?
I found the answer myself.
There is a filter operator 'Top N' which can be used. It seems the field used in expression doesn't matter.
However it seems Reporting services first performs the topN en than sort the remaining data. So I had to make a second dataset anyway.

SSRS Total by Type

I am new to SSRS. I have a report that goes like this
Type Amount
A 500
B 200
A 100
C 400
C 200
I want to convert this to a report like this
Type Total Amount
A 600
B 200
C 600
Basically get distinct Types on the left column and th totals for those types in the right column. Is there a way i can do that easily?
Thanks
Starting with you simple report which just lists the records in your DataSet:
Design:
Results:
Right click on (Details)in the Row Groups section and choose Add Group -> Parent Group:
Choose the field you want to group by (Type in our example) from the Group by: dropdown, choose to add either a group header or footer and click OK:
Your table will now look something like this:
You can delete the second column and the third row - or second row if you chose to add a group footer earlier - entirely (clicking OK when deleting the row and being prompted to delete the associated group), leaving a layout like this:
Now just click the field selector for the empty cell in the table and choose your Amount field:
or right click on the empty cell, choose Expression from the context menu and enter the following expression:
=Sum(Fields!Amount.Value)
either of which should result in the formula being placed into the cell:
Now run your report and you should get the expected result:
There's loads of places online with similar guides and resources which you can also consult:
MSDN Reporting Services Tutorial (Adding Grouping and Totals)
MS TechNet (Calculating Totals and Other Aggregates)
MSDN (Add a Total to a Group or Tablix Data Region)
There are also several other similar questions here on SO which you'll find if you just search for them.

Dynamically Add\Remove columns SSRS 2012

I have SSRS report that has around 80+ columns. I have requirement where in dynamically hide\show columns in report based on user selection. I could able to do it by setting expression for "Visiblity" property and having report parameter thro' which columns to display can be choosen.
My problem is 2 points
fox example if columns 2 and 4 to be hidden, then there is an empty column between 1 and 3 and 5 columns. How to avoid this
When i export to PDF / Excel these spaces prevail.
Let me know your suggestions / help.
You can create a query that pivots your data, so that instead of a return table like this:
ColumnName0, ColumnName1, ColumnName2
Value[0][0], Value[0][1], Value[0][2]
Value[1][0], Value[1][1], Value[1][2]
You could format it like this
ColumnName, Value0, Value2
ColumnName0, Value[0][0], Value[1][0]
ColumnName1, Value[0][1], Value[1][1]
ColumnName2, Value[0][2], Value[1][2]
And then your first column (ColumnName) would always be your title, and you could use it as your column group. You might have to use a dynamic query for this, but it would take care of both items 1 and 2 in your question.
Actually I solved my issue with following URL
http://bhushan.extreme-advice.com/conditionally-setting-column-visibility-in-ssrs/

In SSRS is there a way to make a Row Group expand based on parameter value?

I've got a table with 5 columns, the first 3 of which allow the user to drill down through the levels of detail. Each of these columns (Region, Country & Office) has an associated Parameter so the user can select the geographic region for their report. Each parameter allows the selection of multiple values.
If the user selects 1 Region, 1 Country and 1 Office it's not exactly ideal for them to then have to expand each selection. Is there an expression I can enter somewhere to state that if only 1 value is entered in a parameter then that data set will automatically show as expanded?
This is in SSRS 2008 R2 if that makes any difference.
In the Group Properties for the detail group you can enter an expression for the initial visibility. Right now you probably have that set to "Hide." The expression needs to return a Boolean and could be something like:
=Parameters!Country.Count <> 1
This will have SSRS hide those rows if more (or less) than one value are selected in the parameter Country
But I have seen some unexpected results with this: test thoroughly. In my experience, BIDS handles these better than SSRS itself, so just when you think you've got it all working, it fails miserably once deployed. (Reason number 14 to have a test folder on production SSRS.)

SSRS- Bar Chart with single bar needs to display Percentage data

I have a requirement to show percentages in bar chart on a single bar using SSRS. For example, I want to show a employees by Age in a percentage in an SSRS report.
1.How many % employees between age 20 and 30?
2.How many % employees between age 30 and 40?
3.How many % employees between age 40 and 50?
All this on a chart which has only single bar chart in percentage?
Is it possible?
Thanks
Not sure I'm really understanding the question ("a chart which has only single bar chart in percentage"?), and I realise it's an old one, but I just came here with what I think is the same problem, and wanted to offer the solution I've come up with.
As far as I understand it, you have a bar chart which shows employees grouped by age. Age bracket along the X axis, number of employees (which I'll presume is calculated by something like "COUNT(Fields!EmployeeID.value)") up the Y axis. You want to see the percentage of employees which fall into each bracket.
What I've done is go into the chart properties, "Data" and select the "Values" entry for "Employees" (or similar). Then, hit Edit and add point labels, with a data label such as:
=COUNT(Fields!EmployeeID.value) / COUNT(Fields!EmployeeID.value, "Employees")
Where "Employees" is the name of your data set.
This is dividing the value of the current data group (from the "Values" tab) by same value but taken over the whole dataset.
Enter a format code of something like "#0%", et voila!
It achieved what I was after, and I hope it can help others with the same question.
You can easily do it in 2008, but I guess that's not what you wanted to hear.
So basically you want the concept of a pie-chart but as a single bar (known as a linear gauge in 2008)?
I don't think you can. This is about the limit of what you can do
http://msdn.microsoft.com/en-us/library/aa964128%28SQL.90%29.aspx
You could always buy dundas http://www.sql-server-performance.com/articles/reporting/Enhancing_Reporting_Services_with_Dundas_Reporting_Controls_p1.aspx
essentially this what MS have rolled into 2008