SSRS Row number based on 2 groups - reporting-services

How to create row number based on 2 groups
My issue is
I created new field named test to test row number and my code in next pic link
Group based on ItemId
but if the item duplicated the row number start duplicate also like next Pic
hot to create number sequence based on vendor and itemid , i need the number sequence continues with every item even it duplicated

You need to add the scope. Then the runnung value will be calculated on the whole dataset or based on your grouping. For example:
=RunningValue(Fields!ItemId.Value, Count, "YourDatasetName")
=RunningValue(Fields!ItemId.Value, Count, "YourGroupName")
This gives you two different results based on the scope. And you need the second one I think.

Related

SSRS Pivot Creating Extra Rows

I have a report and need to pivot on SLOC (storage location). It all works great except it creates extra rows due to the storage bins being different even though I'm not grouping on them. The first image shows what I have. The second image shows what I want. How do I 'push up' the rows?
Rows Grouped on "Part Kit" then "Material"
Columns Grouped on "SLOC"
Currently Looks Like this
I want it to look like this
You can achieve the desired format by adding a row number to group on. This will tell the report where to position things. In this case I added a row number like this:
ROW_NUMBER()OVER(PARTITION BY SLOK, PartMaterial ORDER BY StorageBin) as RN
Here is a sample of how it looked before:
And here it is after I grouped the rows by the row number:
Of course, you can hide the row number, but this shows why and how it works. In this case, I added a child row group after the part material and grouped and sorted it by the row number.

Total of Custom Expression

I'm trying to get the total of the "Conversion" column for each "AccountDescName".
However, the expression inside is also grouped by the statdate.
How would I go about getting the total of the conversions.
When I paste that same expression in a row below, it gives me a different number.
In order to get a subtotal by account, you'll want to add a new row that is inside that group, but outside the StatDate group. Right-click on the field that was highlighted in your first screenshot. Select "Insert Row" -> "Outside Group - Below". This new row is where your subtotal will go. You can usually copy the same expression here and it will evaluate within its new scope.
For a grand total, you would follow similar steps, but you would insert the row outside the account group. This would result in one final row at the end of the entire table.
I figured it out by keeping my data split up by rows and removing duplicates.
Did not do any aggregation in SQL.

how can we separate totals on the basis of group

how can we separate the totals on the basis of column value. need to create a report which have multiple columns, every column have multiple values. need sum of every row group value. I have added sample as below. please help me regarding same.
This is as single as context clicking on your field and clicking "Add Total". Clicking this option will add a subtotal to your next group. Clicking again on that total will create a new total on the next group level until you eventually get to the final, grand total.

Interactive sorting in tablix with column and row groupings

I'm trying to define interactive sorting in a tablix. The sorting should affect the row order.
Attaching image of the tablix in order to explain what I'm trying to get:
I already tried to define the column header with interactive sorting and get SubjectParentID to be sorted by expression (the same expression as described bellow). The final setting I made is to apply the sorting to all groups in the tablix -
Attaching image:
The result wasn't current and the data got messed up in the cells.
Additional information: The columns are grouped by SubjectParentID. The rows are grouped by Username as parent and UserID as a child group.
The values are result of the following expression :
=iif(isNothing(Fields!ResReqCertID1.Value),
-99,
Sum(iif(Fields!CertStatusID.Value = 3
Or Fields!CertStatusID.Value = 4
Or Fields!CertStatusID.Value = 5,
1,
0)) - Fields!ResReqCertID1.Value)
In the Text Box Properties / Interactive Sorting window, change the Groups selection to the UserID group (assuming that is the most-detailed group providing the rows in your example).
This can't be done, interactive sorting cannot sort row groups by column values calculated within that group.
If you have 4 static columns you could hard code them. Then having no need for column groups interactive sorting should work as expected.
You could also define a static number, say 10, of dynamic columns, and use pivoting in the thebsql query to get columns 1-10 and their labels. Then set up 10 columns with interactive sorting on the Value_1 fields, and hide them if no data exist for that column. You could then also have an 11th column which also does column grouping but doesn't do sort if there's any chance you'll ever exc3ed the 10 columns.
You could also do this: https://www.c-sharpcorner.com/article/ssrs-interactive-sorting-on-matrix-column-group/ which is somehow even more complicated than my two solutions.
But yeah, you basically can't do this. SSRS cannot be told to sort row groups on values calculated from within the context of the column group that contained the copy of text box in which the sort button was clicked.

Selecting total results on a report

I have a matrix with several columns and rows. Example the rows are made up of names for a company and along the top are total sales, total calls, etc. So each row will have a number under each column, and at the bottom of each column is a total for each column. Currently i have the report set up that if you click on any of the numbers it pulls up a detailed report for those particular items. But if you select the total number it brings up the results for the first row's column. Is there a way to make it return all the items details when you click the total number for that column instead of what ever the detail would be for the first row of that column? Does this make sense?
You can use the inscope function to check whether you are in the value or total row. If you are not in scope then pass the correct parameter to the details report.