How to create a parent group totals based on different child group - reporting-services

I'm not sure if I'm phrasing this correctly...
I need help splitting a total to have multi-rows/columns inside a total;
or another way to say this is, I need to have a parent group total with based on different child group.
Please see the picture below:
I am using matrix element for my stepped report. I have 4 tiers of groups on the Y-axis, and 3 tiers of groups on X-axis. On the y-axis, I have created totals for my tier 2 - Products (Linked/non-par) and totals for my tier 3 - products (A / B).
However, for the tier 3 - products (A / B) total, I need to split that total into total-A and total-B, so that the accumulative total values (66800) would be split into the sum of product A and sum of products B.
I'd like to do this without using expressions if possible. But if there are no solution, I'm open to Expression or changing dataset w/ T-SQL (if necessary).
Any ideas?!

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.

How to take % value for Line graph for series Groups ?/How to plot graph by sql table?

Approach 1:How to take % value for Line graph for series Groups?
I am setting up a ssrs report like with x axis(Category Group) as Finished Week, QualityPercent( as Series groups-RFT%,REwork%,Scrap%) and Values as Sum of Quantity.
In the above graph the quatities are shown in percentages based upon weeks(the actual result whose plot values are given at left side of image). Respective tables structure:
But I am getting the chart like this
Here the y axis is not plotting well asper the category values, sometimes shoots upto 250%!! or 1400% !!! (this is embarrassing).
For the above graph i used expression as:
IIF(Sum(Fields!QTY.Value,"Chart11_SeriesGroup"),Sum(Fields!QTY.Value)/Sum(Fields!QTY.Value, "DataSet_Production"),0)
What i am missing? I even used #Percent. Kindly help me.
Approach 2: How to plot the ssrs graph using below result from sql query?
FinishedWeek QualityPercent QTY Percentage
1 Rework (%) 844 0.109724
1 RFT (%) 6811 0.885465
1 Scrap (%) 37 0.004810
2 Rework (%) 742 0.094618
2 RFT (%) 7096 0.904871
2 Scrap (%) 4 0.000510
After much work done with second approach, I wrote the separate query for the above table
asper the link:
Calculating percentage within a group
select t1.FinishedWeek,t1.QualityPercent,Sum(QTY) as QTY,Sum(QTY)/ t2.TOTAL_QTY as Percentage from #temp
AS t1
JOIN (
select FinishedWeek,Sum(QTY) as TOTAL_QTY from #temp
group by FinishedWeek
) AS t2
ON t1.FinishedWeek= t2.FinishedWeek
group by t1.FinishedWeek,QualityPercent,t2.TOTAL_QTY
From above query , took the Finished Week as Category, QTY as Values, and QualityPercent as Series Groups

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)

Subtotal filtering without a group

I have a report with 5 groups in a Tablix. I want to have 15 total lines based on a filter of amounts within that group. A simplified version:
Group1 Cost Center Relationship Type Amount
A 100 Rel1 Small 100
A 100 Rel1 Med 100
A 100 Rel2 Small 200
Total for A Small: 300
Total for A Medium: 100
I cannot group on Type because I am ordering by Relationship.
I added 2 more group rows to make 3 (one for each Type). I used "Add total" to the existing group. I tried using an IIF(Fields!Type.value="Small",SUM(Fields!Amount.value),0) in the group row but all I get is zeroes. I am not sure if I need to specify a scope because it is in the group already.
Well, IIF(Fields!Type.value="Small",SUM(Fields!Amount.value,0) wont work as it is.
You would need:
IIF(Fields!Type.value="Small",SUM(Fields!Amount.value),0)
Or try this:
SUM(IIF(Fields!Type.value="Small",Fields!Amount.value,0))
I forget in a GROUP footer if you need to SUM() inside the logic (top example) or SUM() the result of the logic (bottom example)

SSRS Show a percentage of a a total value

I have a regular Table in SSRS. With 3 Groups...
(Parent) STORE - CLERK - PRODUCT (Child)
I have some regular aggregations. How many PRODUCTS Sold by a CLERK , How Many CLERKS Per STORE and Eventually How many PRODUCTS Per STORE
On top of the Regular Sums And Avgs, I need To Find Out The Percentage of PRODUCT (Type) Meaning a Particular value of that Group.
Example STORE 001 Has Sold 10 RADIOS (a PRODUCT) and There has Been 100 RADIOS sold by all Stores
So Basically What I Need is to show STORE 001 is Responsible for 10% of all RADIO Sales.
(A note: Ideally , I would Like to show this To adjust to the Data - So if I add new products It will group those as products (Naturally) but still give me those percentages)
= fields!product.value / sum(fields!product.value)
in its most basic form you would want to use something like this.
The first will give you the total of the current row of data and the second will give you the total of all rows of that product.
Thus you would have 10 / 100 (per your example).
This is assuming that you have your data structured correctly. Depending on the structure of you report you may need to add a scope to your total summation to make sure that you are not totaling any other datasets that may reference the same product or field.
sum(fields!product.value, "--your dataset here--")