How to sum a row based on the total group in SSRS - reporting-services

Im facing an issue whereby how to sum the % for each of column based on group in SSRS by using expression. Refer my use case below
I have one outcome which all the product with a percentage result. Refer to my screenshot
enter image description here
Below are my SSRS template.
enter image description here
How we get percentage result. Example: Product PG is based on 13(based on total PG) divide 51(total Inv)
Issue: I want to sum each of percentage result for all the item Example 25% + 41% + 4% and etc to populate under excel column V6.
Therefore i need some ideal how to write in SSRS expression or it only can done via query.
Seek for any ideal how can this be done.

You can try as below since you have use static columns:
=(Sum(TotalTintCash)/Sum(TotalInv)+Sum(TotalTintFOC)/Sum(TotalInv))
And then, you can provide number formatting to percentage

Related

Add total with different in percentage in SRSS Power BI report builder

I have a matrix with sales for district and store on the rows and different "time intelligence" on columns. I want to add totals. It works fine for values but for "YOY %" I don't want to sum the individual percentages of course - I want to have the total YOY for the values on the total row. How can I refer to these values? See the picture, the red value should be 109/77-1 = 42 % and not 183 %.
Any input is appreciated.
enter image description here
enter image description here
To answer my own question: I didn't figure out a way to referring to columns generated from calculation groups (is it even possible?) so instead I created all the measures (columns) as seperate columns in the dataset. Then I can easily refer to them like YOY %:
=( Sum(Fields!Actual.Value) - Sum(Fields!PY.Value) ) / Sum(Fields!PY.Value)
and the totals is shown correctly.

SSRS Max Row Value across all columns

I'm busy with a report to show maximum value for a group, however when I do a MAX function I only get the the same result as the current row and I require it to be the same/highest MAX value in all rows. I need to do this on the report itself as the data set is MDX.
As you can see below, I require the max column to be 67% on all the rows.
Report Screenshot
You need to include the scope in your expression, something like
=Max(Fields!ColA.Value / Fields!ColB.Value, "myDataSetName")
or
=Max(Fields!ColA.Value / Fields!ColB.Value, "myColumnGroupName")
Without seeing the full design I can't tell you what it should be but the first option above would give you the max amount over the entire dataset and the second example would show calcuate this within the columngroup.

SSRS percentage of a total with column groups

I apologize in advance if this is not enough info or if it is confusing (This is my first post to the forum and it's a little hard to explain what i'm trying to do). I have been researching this for a couple days now. This article comes really close to what I need, but this person did not have column groups, just a a single column with an output: SSRS percentage of a total.
Consider this layout and groups:
The idea is to provide the percentage of the total records per PrimaryPayor per Company and then break it out by Year-Month.
This expression:
=CountDistinct(Fields!ID.Value, "Primary_Payor") / CountDistinct(Fields!ID.Value, "Company")
Results in this output (The first image is my output, the second is the desired output):
As you can see, the percentages do NOT group by Year-Month, instead just provides the total percentage of IDs per Payor per Company and repeats it for every Year-Month column. How can I get the percent of Total IDs per payor, company, and month as it shows in the second result image?
After editing my question, I thought of something I hadn't tried.
If I just use =CountDistinct(Fields!ID.Value), this gives the total count for each payor, company, month, plus, I added a Total row.
Then, if I reference those textbox values (instead of trying to calculate the percentage on the fly) divided by the total row, I get my results. I just had to add a column inside of the column group. I should then be able to just Hide my "total" column and display only the percentages.
=ReportItems!Textbox50.Value / ReportItems!Textbox35.Value
Here is the output (with the total counts and then after hiding the "count" column):
Final Results
Try:
=CountDistinct(Fields!ID.Value) / CountDistinct(Fields!ID.Value, "Company")
I removed the Primary_Payor scope leaving the function calculate the count in the cell scope Primary_Payor and DOS_YrMo.
UPDATE:
=CountDistinct(Fields!ID.Value) / CountDistinct(Fields!ID.Value, "DOS_YrMo")
Let me know if this helps.

How can I add an aggregate percentage to an SSRS report based on two specific columns in a matrix?

I am somewhat new to SSRS and I have built a matrix report that looks fairly simple:
Supplier [AccDate]
[SupplierName] Sum(PurchasingCredit)
Total <<Expr>>
The actual report shows month-by-month sales data for a year in addition to Current YTD and Previous YTD columns (joined via UNION clause in base query) in addition to a column showing Year-over-Year % as difference between the Current YTD and Previous YTD columns (also joined via union).
I was able to apply a dynamic format to the Year-over-Year column using the following expression in the Format property to show the YOY column as a percentage and the others as dollar amounts:
=IIF(Fields!AccDate.Value <> "YOY", "'$' #,0.00;'$' -#,0.00", "#,0.00 %;-#,0.00 %")
The last thing I need to do is to show the column totals, which are working for each column with the exception of the year-over-year percentages using the following:
=IIF(Fields!AccDate.Value <> "YOY", SUM(Fields!PurchasingCredit.Value), 0)
In the year-over-year (YOY) column, a sum of percentages doesn't make sense: I need it to recalculate this value based on the sums of the "CYTD" and "PYTD" columns, but I can't seem to figure it out. Any help would be greatly appreciated. I am guessing it is probably an application of scope, but the MS articles that attempt to explain this are very confusing.

Sum function in Report Builder 3.0

I am creating a report that will sum up all subtotal per MaterialNo/Color/Quality/Size.
Here's my sample report:
Computation will be GrandTotal = sum(Subtotal)
I am using =Sum(Fields!TOTAL_CTN.Value) but the result is 12.
Is there a way to compute using like =sum(subtotal_TextBoxName)?
I'm still not 100% sure of your underlying data and business logic, but here's one approach that might help.
I'm working off the following sample data:
Based on what your description above, it sounds like you have something similar to:
Which gives results:
It seems that you don't actually want to Sum TOTAL_CTN, rather this should be the same for every MaterialNo with the Sum only applied in the Grand Total.
As such you can change the Sub Total aggregation to Max and, since you're using Report Builder 3.0, you can then take the Sum of the group level aggregation values. The report will look like this:
Where the Grand Total expression is:
=Sum(Max(Fields!TOTAL_CTN.Value, "MaterialNoMax"))
In this expression MaterialNoMax refers to the name of the Row Group (based on MaterialNo in my example).
This gives your desired results:
The key here is thinking about what aggregation gets applied at each level and how these roll up to the end total.