SSRS Grouping specific rows - reporting-services

Wondering if it is possible to only group specific rows in a tablix as when I add a child group it groups all 3 row of my tablix and I need it to only group the bottom 2.
The tablix does not have a header and I need the top row to be grouped on 2 fields and the next 2 rows to be grouped with the above as well as several other fields
Am I just missing something completely obvious or can this just not be done

This cant be done like you descripe it. But you can use a workaround. You need to mark the rows you dont want to group with a indicator (this can be done in a calculated field) Indicator = {0, 1}. Then you group like you descriped it. The grouping should now look like this:
Value Indicator
1 0 '1st row of group
12 1 '2nd row of group
33 1 '3rd row of group
Now you add a filter to your tablix where you exclude all rows where the indicator value is 0. Then it would look like this:
Value Indicator
12 1 '1st row of group
33 1 '2nd row of group
Of course your indicator needs a expression which identifies the first row per group.

Related

SSRS Report - Badges

Is there an easy way to do a page of badges in an SSRS report? I am looking at 2 across and 3 down per page based on a list. I have built one so far of a single column using a list box but the problem is that it is not advancing to the next record and shows me the same record over and over until I get to the end of the count of total records in the dataset so I know I am doing something wrong. I am using Visual Studio 2017
I use a matrix when I am making a grid with boxes that go across and down.
First I add a ROW_NUMBER to the query to have the order in which to show the records. I subtract 1 so the values start with 0.
SELECT *, ROW_NUMBER()OVER(ORDER BY EFF_DATE) - 1 ROW_NUM
FROM BLAH_BLAH...
Then in SSRS, add 2 Calculated Fields to the dataset with the ROW_NUM.
The first is named ROW. It will have an integer with the row that the record will end up in.
=INT(Fields!ROW_NUM.Value / 2)
The second is COLUMN that will give the a column number.
=Fields!ROW_NUM.Value MOD 2
Then in the matrix, set the grouping based on the calculated fields.
COLUMN GROUP
Group and Sort by COLUMN
ROW GROUP
Group and Sort by ROW
The 2 can be changed to use whatever number of columns is needed.

SSRS, return rows into a grid layout

I have a dataset that I need to arrange into a grid on a page (export to pdfs) as a customer report. Each row in my dataset needs to display as a cell. Each page would have roughly 3 records displayed as columns and then 4 rows of records. e.g. a (3x4 grid), being 12 records per page.
Right now I am using a matrix to display my results, but I cannot find how to get my matrix to start a 2nd row after 3 columns are generated.
Is this feasible or should I find a different solution to create these reports?
I was thinking may be if I had row groups to use, but not sure how to create a column that creates a repeating result 3 times then adds 1 to the next 3 results in my query. 111,222,333,444 and that could be my row grouping?
Here's what I use in a matrix to create a grid of columns from a single cell.
Add a ROW_NUMBER field to the dataset query and subtract 1 with the ORDER BY using the field to be ordered by.
ROW_NUMBER()OVER(ORDER BY DISPLAY_NAME) - 1 AS ROW_NUM
Add Calculated Fields to the dataset using the ROW_NUM.
Call the first COLUMN and MOD row_num by 3 to get values or 0 - 2 for the column number:
=Fields!ROW_NUM.Value MOD 3
Call the second calculated field ROW and get the INT of ROW_NUM divided by 3 to get the row number for the record:
=INT(Fields!ROW_NUM.Value / 3)
Then the matrix would have the Column grouping (and sorting) based on the COLUMN field and the Row grouping on the ROW field.
You could use a parameter as the number of columns (3) to make it easy to change.

Calculate Min and Max for aggregation in SSRS report

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)

How to apply count for three different row from one row in mysql

Looking for the best solution. Actually I want to separate three columns from one column in mysql. My table consist one date column and status column. In that status column there are three values would be repeated likewise 0 for red color in my project and 1 for green and 2 for yellow. Now I want to draw a bar chart based on the status. So I need how many 0 and 1 and 2 in status column
Code i have tried so far:
SELECT MONTHNAME(datepicker) MONTH, COUNT(*) as Total,(status = '0' )as red , (status = '1') as green ,(status = '2') as yellow
FROM mrinsert
WHERE YEAR(datepicker)=2018
GROUP BY month(datepicker);
But I'm not getting the correct report. The output looks like this
In first month february consist two affected rows means status values are 1 and 2 but here only green column only affected.I'm looking for one green and one yellow. same problem in the last row as well. help me to achieve!!!

SQL Report Builder for Survey Data

I have a large dataset with People's names and their Rating from 1 to 5.
Then I made a query that summarizes this data for PersonA:
Rating Count
------- ------
1 4
2 6
3 1
4 0
5 2
I just need to know how to show this on my report.
I have made a cell for each rating and need to put in an expression that says "If Rating=1, show count for rating 1".
I tried using =IIf(Fields!Rating.Value = 1, Fields!Count.Value, 0) but this didn't work.
I'm not sure why you would need an expression like that, based on your description of the dataset it sounds like you already have two columns of data for rating and count, so you could use a tablix (table), with columns:
Rating Count
which would list all the rating values and associated count values, similar to the example result in your question.