In an existing ssrs 2008 report, I have added a few new columns to the existing report as requested by the user. In addition, the user wants to be able to sort the data on any column on the report by using a sort parameter value.
The data does not contain any summary values. The columns in the report include:
a. student number,
b. student name,
c. birth date,
d. age,
e. current grade level,
d. attendance code value.
The default value is to sort by student name alphabetically. Whatever field is to be sorted first, the student name will be the second.
I have tried to sort the data at the tablix level and the row group level and the logic has not worked yet. There is no row group setup right now.
Thus could you show me how to setup the sort by using the parameter value? Would you show how the ssrs report needs to look for me to accomplish this goal and/or point me to link(s) that will show me how to accomplish this goal?
On the row group's Sorting, set the Sort By to use the Sort parameter to determine which column to sort, like:
=IIF(Parameters!SORT.Value = "NUMBER", Fields!STUDENT_NUMBER.Value,
IIF(Parameters!SORT.Value = "NAME", Fields!STUDENT_NAME.Value,
IIF(Parameters!SORT.Value = "BIRTH_DATE", Fields!BIRTH_DATE.Value,
IIF(Parameters!SORT.Value = "AGE", Fields!AGE.Value,
IIF(Parameters!SORT.Value = "GRADE", Fields!GRADE.Value, Fields!STUDENT_ATTENDANCE_CODE.Value)))))
Set a second SORT to use the Student_Name field.
Did you try using interactive sort. That way users can sort on any column in the table. In my experience this has worked perfectly well.
Here is more info- (the first section is what i think you would need - Sorting Detail Rows for a Table with No Groups ) -
https://technet.microsoft.com/en-us/library/cc627509(v=sql.100).aspx
Let me know if that was helpful.
Select the tablix, right click and click on Tablix Properties
Go to the Sorting Tab. Click Add (below the Change Sorting Options)
Now select the order or click expression and write an expression to sort the columns based on parameters supplied.
Click Ok
In the order select A to Z ASC or Z to A for DESC
You need to select each column and select A to Z or Z to A
For example
In the expression,
IIF(Parameters!SORT.Value = "NUMBER", Fields!STUDENT_NUMBER.Value,"")
In the order column select A to Z or Z to A
Related
I am new to SSRS and have a SUM(IIF question.
My data set contains four columns: Date, GroupID, PlanPaid, and NetworkIndicator.
Here is an example of the data set:
I am trying to SUM the [PlanPaid] amount when [NetworkIndicator] = "In Network".
However, I need this amount broken up by the [Date]. I tried accomplishing this by creating the expression:
=Sum(IIf(Fields!NetworkIndicator.Value = "In Network"
, Fields!PlanPaid.Value
, Nothing)
, "Claims_Rolling12")
But this expression returns the same amount (total) across all [Dates]. How do I break it up so that it is grouped by the correct [Date]?
Here is a photo of my Tablix and my current Groups: [Tablix and Groups]
And here is a photo of the output: [Output]
You haven't said where you want this sum to appear, so the answer here might not work. If it doesn't then edit your question to show what you expect the output to look like based on your sample data.
I'm assuming here that you want to add a new column to the report that shows "In Network total" by date.
The easiest way to do this is to add a row group that groups by date, then within this group you can use a simple expression, like the one you tried, but without specifying the scope.
=SUM(IIF(Fields!NetworkIndicator.Value = "In Network", Fields!PaidPlan.Value, Nothing))
This expression will only sum rows that are within the current scope, in this case the scope will be the row group you created to group by dates.
As IO said, if this is not helpful, edit your question and show what you expect your end result to look like, based on the sample data you supplied and then I can look at it again.
I saw the post on WHERE clause in SSRS expression. I am also trying to do a where clause, but in a different way. I need to show ItemDesc when ItemId = 4. I set a parameter so that it will always equal 4 for this cell. Now I just need the matching description field. I cannot hard code it because the description may change one day. Is there a way to associate the two fields?
=IIF(Parameters!ItemID_4.Value = 4, Fields!ItemDesc.Value,"")
I am converting from Crystal Reports to SSRS. This first image is the output from CR. I only need to show that ItemDesc in that top left cell.
This next image is from SSRS. It is not limiting the descriptions. It seems to be doing what my expression is saying. ItemID = 4, so display all ItemDesc values but the two fields are not associated right now. I need it to only show the matching value.
Thank you for your help.
I cannot hard code it because the description may change one day.
You are hard coding the parameter anyway by trying to do it that way. I don't think you need a parameter to achieve the result unless you are restricted from adjusting the dataset query.
If you are using an embedded SQL query for your dataset, I would just put a filter in WHERE clause: WHERE ItemID = 4
Another way if you can't adjust the query is to go to Report Data view > Right click on the dataset for your table, "Dataset Properties" > go to the "Filters" tab and add a filter with these settings: Expression = ItemID, Operator = "=", Value = "4" (or "#ItemID" if you want to keep your parameter).
I have a table as shown below:
Table 1
I need to display data like below. I have tried using grouping but but i failed.
I have read some topics but can't find the solution. This should not be that hard.
Table 2
You can get that using LookupSet over a dumb group.
Add a tablix to your report and add a parent group in the Row Groups pane.
Use the below expression to create the group.
=1
That expression will create only one group, and you will have something like this in design.
Then use this expression in the highlighted cell in my screenshot above.
=join(
LookupSet(1,1,Fields!ColumnA.Value,"DataSetName")," - ")
Where Fields!ColumnA.Value is the field of X, Y and Z values, and DataSetName should be the name of your dataset.
You will get this result.
If you have repeated values in ColumnA they will appear repeated too in the cell. You will have to filter your dataset to get only unique values.
I have stored procedure which returns around 100 rows. One column is Category.
In SSRS, I've created DataSet related to that stored procedure. On Report body I have Tablix, which I relate to DataSet.
Now, I have additional parameter, called FilterColumn, which consist all different categories from dataset, plus one row called "All products".
How to filter tablix based on that parameter to show me whether products from specific categories or all products?
You need to set up a filter similar to the following:
Where the expression is:
=IIf(Parameters!FilterColumn.Value = Fields!Category.Value
or Parameters!FilterColumn.Value = "All products"
, "Include"
, "Exclude")
This matches the row Category based on the parameter value, or, if the value = All products, will include all rows.
As mentioned in the comments and the other answer, this is possible in the SP too, but since it seems to be specifically to demonstrate the functionality this should do the trick at the report level.
I have created some solution and worked for me:
In Expression field, I put first expression:
1. Iif(Parameters!FilterColumn.Value = "All", 1, Fields!Category.Value)
In Value field, I put second expression:
2. Iif(Parameters!FilterColumn.Value = "All", 1, Parameters!FilterColumn.Value)
So, when I choose "All" value in parameter, then first expression will result 1, and second expression will result 1, and i have 1 = 1 which is true for all rows, and I got all rows in table.
When I choose specific category from parameter, then in first expression result will be Fields!Category.Value and in second expression will be Parameters!FilterColumn.Value. Simple, I got Fields!Category.Value = Parameters!FilterColumn.Value, or just give me rows where category is that choosen in parameter.
Pass the Additional Parameter to your store procedure, so you send data that is already sorted to your report. This will avoid multiple Tablix created depending on your parameter selection.
I have a expression inside a tablix for one of my report column Cases Shipped like this
=IIF(Fields!Current_Product.Value= "Match"," ",Sum(Fields!Cases_Shipped.Value))
This add the cases shipped value of same ditributor item code.
After this statement i want to apply a filter on this column on the report .there is a textbox parameter in which a user enter the number like 10 and the column on report get filtered through this value.
How can i do this??
Sounds like you are looking to change the Column Group visibility. (You are using column groups, right?) If so, right click on a column group and you can set the visibility by formula. The formula can incorporate a Parameter.
=IIF(sum(Fields!Cases_Shipped.Value ) >= Parameters!CasesShipped.Value and (Fields!Stocked.Value = "" OR Fields!Stocked.Value = "Yes" OR Fields!Stocked.Value = "No"), false, true)