My report look like below
Region1 Region2 Region3 Region4 Region5 state1 state2 state3 state4 state5
I have created column selection parameter and Region value 0
State value 1
How I need to make changes if I select Region only regions 1 to 5 are displayed, or if I select State only states 1 to 5 are displayed?
Can you please help me guys I have been stuck for 3 days. I tried of selecting using single column selection by using below
expression =iif(instr(Join(Parameters!ColumnSelect.Value,","),"01")>0,false,true)
But i am unable select 5 columns at a time.
I think your expression should be:
= Not(Join(Parameters!ColumnSelect.Value,",").Contains("0"))
I would be applying that as the Column Hidden Expression for the Region columns. A similar expression (with the "0" changed to "1") should work for the State columns.
Set the Hidden Condition of each column individually. Make sure you are selecting the columns under Column Groups in the Advanced Mode of the Grouping Window:
Region Columns Hidden Condition:
=Join(Parameters!ColumnSelect.Value,",") not like '*0*'
State Columns Hidden Condition:
=Join(Parameters!ColumnSelect.Value,",") not like '*1*'
I am using below expression
=IIF(instr(Join(Parameters!ColumnsSelect.value,", "),"0")=0,True,False)
=IIF(instr(Join(Parameters!ColumnsSelect.value,", "),"1")=0,True,False)
Related
My SSRS report have a dataset that will return the following result. The result set for some reason may not be changed. Note that Category - SubCategory pair might not be distinct.
Category Sub-Category Value
-----------------------------
A A1 100
A A2 120
A A2 60
B B1 80
B B2 90
B B2 70
I want to show the max value and main value for each of the SUM(category, subCategory) in report matrix, as exactly the format as follows (except the comment in bracket):
Max | 180 (two A-A2 rows)
Min | 80 (B-B1)
How can I define the matrix and write the expression? If make a group on these two columns, The matrix will show four rows regardless of what expression I set.
I tried to run your use case on my local SSRS.
On Left hand side I have original Data and on Right hand side I have the desired result you expect.
What you need is grouping as below
Expression for sum as below
Put a tablix into your report. Then at Row Groups (bottom) click on the (Details) and chose Add Group > Parent Group. Click the Add group header and chose your Sub-Category. Do the same with your Category. Your Row Grouping hierarchy should be now Category > Sub-Category > Details.
Now you see the brackets on the left in your tablix, they indicate the level. If you use now the following expression with their group name on the specific level, you will get what you want.
'At the Category group level header
=Sum(Fields!Value, "CategoryGroupName")
'At the Sub-Category group level header
=Sum(Fields!Value, "SubCategoryGroupName")
I got the way to make it. The solution is as follows:
Make a row parent group called row. Let the group group by a constant.
Make a child group category under the row group which is grouped by Category.
In matrix cell which is inside the group, Add this expression: =Min(Sum(Fields!Value.value), "Category"), "row"). that's the reason why I make a constant group, because I want to make the nested aggregate function legal.
This expression will return all values identical within the Category group. Now add another row outside of these row groups. Pick a cell and enter =ReportItems!ThatTextBox.Value.
Hide the row which consists your groups.
Do the same for MAX value (Start from adding an adjacent group, grouping by constant)
I need to create a report which is something similar to a Pivot Table.
The report would be something like below, with more towns
I C S Total
Town1 1 2 3 6
Town2 7 1 1 9
Town3 2 3 1 6
Total 10 6 5 21
In Crystal reports, there is an integrated function called Cross table
(see pictures below)
I'm looking for a similar function in SSRS, if there is any. I parsed the internet but I could not find anything that is relevant
Thanks!
You need a matrix to do so
Select the row, once the matrix created, like the image below and click on the row group and look at the group properties
You then choose the row for which you want to do the grouping like the image below
Repeat the operations for the column group.
You will need to add additional row and columns for the total.
I will do that for the row. You click the row to highlight it and then click on insert rows. You then choose Outside group below like in the picture below
Repeat the operations for the column group.
To have total, please put the following formula in your row and column created outside of the group SUM(COUNT(Fields!name_of_your_field.Value)) and you have the double entry table.
Let me know through the comments if you have any issues, I'll happy to help.
I have a table which tooks like this:
ID_1 Total Active Inactive
124507 4 1 3
124519 4 0 4
124521 4 2 2
I would like to add a column at the end, which would tell me which percentage of the the total are active?
like:
ID_1 Total Active Inactive %
124507 4 1 3 25
124519 4 0 4 0
124521 4 2 2 50
Format(((active) / (total)), Percent)
Reference: http://www.techonthenet.com/access/functions/numeric/format.php
Make a query in query design. Include the table you already have. Drag all the fields from your table to the bottom of the screen where you can put fields to include them in the query. In the next empty box, put:
NameofNewField:Format((tablename.Active)/(tablename.Total), Percent)
This will create a new field in your query, with NameofNewField being the name (change it to whatever you want, but I wouldn't recommend "%"). Also be careful of reserved words, because "Percent" is a reserved word and you'll get an error if you wanted to make that the field name. "tablename" is just the name of your original table.
I included "Format()" in the formula because that way you can just make the query with no other editing, but the better way is to format the field you are making into a percentage into a field that only allows percent, because personally I have problems with Format() sometimes. You can change the field by putting your cursor in the box where you just wrote your formula, then it should show field properties on the right side of the screen where you can change the field to a percent field.
I have a table in a SSRS report that is displaying only a group, not the table details. I want to find out the row number for the items that are being displayed so that I can use color banding. I tried using "Rowcount(Nothing)", but instead I get the row number of the detail table.
My underlying data is something like
ROwId Team Fan
1 Yankees John
2 Yankees Russ
3 Red Socks Mark
4 Red Socks Mary
...
8 Orioles Elliot
...
29 Dodgers Jim
...
43 Giants Harry
My table showing only the groups looks like this:
ROwId Team
2 Yankees
3 Red Socks
8 Orioles
29 Dodgers
43 Giants
I want it to look like
ROwId Team
1 Yankees
2 Red Socks
3 Orioles
4 Dodgers
5 Giants
You can do this with a RunningValue expression, something like:
=RunningValue(Fields!Team.Value, CountDistinct, "DataSet1")
DataSet1 being the name of the underlying dataset.
Consider the data:
Creating a simple report and comparing the RowNumber and RunningValue approaches shows that RunningValue gives your required results:
You can easily achieve this with a little bit of vbcode. Go to Report - Properties - code and type something like:
Dim rownumber = 0
Function writeRow()
rownumber = rownumber + 1
return rownumber
End Function
Then on your cell, call this function by using =Code.writeRow()
As soon as you start using groups inside the tables, the RowNumber and RunningGroup functions start getting some weird behaviours, thus it's easier to just write a bit of code to do what you want.
I am not convinced all suggestions above provide are a one for all solution. My scenario is I have a grouping that has has multiple columns. I could not use the agreed solution RunningValue because I don't have a single column to use in the function unless I combine (say a computed column) them all to make single unique column.
I could not use the VBA code function as is for the same reason and I had to use the same value across multiple columns and multiple properties for that matter unless I use some other kind of smarts where if I knew the number of uses (say N columns * M properties) then I could only update the RowNumber on every NxM calls however, I could not see any count columns function so if I added a column I would also need to increase my N constant. I also did not want to add a new column as also suggested to my grouping as I could not figure out how to hide it and I could not write a vba system where I could call function A that returns nothing but updates the value (i.e. called only once per group row) then call another function GetRowNumber which simply returns the rownumber variable because the colouring was done before the call so I always had one column out of sync to the rest.
My only other 2 solutions I could think of is put the combined column as mentioned earlier in the query itself or use DENSE_RANK and sort on all group columns, i.e.
DENSE_RANK() OVER (ORDER BY GroupCol1, GroupCol2, ...) AS RowNumber
I need to modify an existing report using SSRS 2008 with a Region name and it may contain 10 different regions. There is only one column set up for the region which may contain 10 different values. I believe it is a tablix. Currently, the regions are sorted in the code alphabetically but I have to sort them differently, so I assigned a number to each in the CASE statement based on the desired order. I then sorted the regions by the required order in the column itself (tablix) and the regions are sorted in the desired order in the report but unfortunately, the number assigned is in the report instead of the region name. Instead of getting
BF CF CO CL etc…. I get
1 2 3 4 etc in the heading of the report.
CASE ,
WHEN teamgroup.Name = 'BF' THEN 1
WHEN teamgroup.Name = 'CF' THEN 2
WHEN teamgroup.Name = 'CO' THEN 3
WHEN teamgroup.Name = 'CL' THEN 4
WHEN teamgroup.Name = 'CN' THEN 5
WHEN teamgroup.Name = 'GA' THEN 6
WHEN teamgroup.Name = 'IN' THEN 7
WHEN teamgroup.Name = 'KY' THEN 8
WHEN teamgroup.Name = 'MD' THEN 9
WHEN teamgroup.Name = 'NF' THEN 10
END AS Region
I tried to display teamgroup.name as region and then used Region_sort as the alias for the CASE statement, but it did not work. In the Tablix Properties, I used sort by: region_sort and order is A to Z but the regions were sorted alphabetically.
any help will be greatly appreciated.
You can sort the tablix in a different manner to what is being displayed.
You should setup the tablix as per normal with the region as the display values, this being the teamgroup.name.
Using the sort option on the tablix will oftern not work depending on the makeup of your table. The best and most reliable way is in the grouping properties window right click the details row and edit the sort by options.
Here you can edit the expression for the sort and I suggest you use a switch function to change the names to numbers, or better yet use the SQL region_Sort column if you have one.
Then set the order to a to z.
If you have groups in your tablix you will need to do this for the teamgroup.name region/group instead of the detail one.