SSRS Column group division query - reporting-services

I’m having a problem with division in my report where its not calculating correctly for the month/year column (CalHeading), which has its own column group.
My expression for both currently below is:
=Sum(Fields!PeriodSales.Value)/Sum(Fields!PeriodSales.Value, "Customer")
As below 72.64% is displaying correctly for the period total column, but the 3.03% should be displaying 94.03%
Edit - I had the wrong code in that was displaying 3.03%, but its still incorrect.
What it looks like its doing is for example putting Feb 2022 as 22.64% of the whole period total column (1,040,677.83 of 4,596,041,37)
Temp Column
Any help would be greatly appreciated

I've managed to get it to work by referencing the text box; e.g.,
=Sum(Fields!PeriodSales.Value)/ReportItems!Textbox306.Value
Will this cause any issues going forward?

Related

I'm trying to aggregate a measure in Power BI Report Builder and getting nowhere

I am working on a sample project in Power BI Report Builder. (I couldn't tag it as such because apparently I'm not allowed to create my own tags on this website.) The measure I am going for in my data cube is called Direct_Claim_Deductible_Recoverable_End_of_Year, but we will call it "Deductible" because that's too long a name to type out every time. I am trying to divide it up by the fields of State, City, and Year.
The Category column tells you whether each row is for a state or a city within that state. The Year and Location columns tell you the year and location that the row is telling you about. The Deductible column shows that measure. The Pct% column formula is Deductible - Total. (I added the Total column because I was having trouble with the Pct% column and wanted to know what was going on.)
Here's where the problem begins.
The Total column is supposed to tell me what the total deductible is for that specific year. But instead, it just gives me the grand total for all years in the cube. I've run the report enough times to know that this number is $99,669.71.
Here is the formula I am using for the Total column:
=round(Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value),2)
The Pct% column is giving me wrong answers too, but it is based on the Total column, so fixing the Total column should also fix the Pct% column.
And the data bar is supposed to show me what percent of the total for that year is in that state's row, or what percent of the total for that state is in that city's row. Instead it gives me an error message saying I am missing a closing parenthesis ')' somewhere:
The Maximum expression for the chart 'DataBar2' contains an error: [BC30198] ')' expected.
Here is the code I used:
=(Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value) / (Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value), "StateDS"))
As you can see, all three sets of parentheses are opened and closed.
I did figure out that if I move all the parentheses to the end, like so:
=(Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value) / (Sum(Fields!Direct_Claim_Deductible_Recoverable_End_Of_Year.Value, "StateDS")))
I resolve that error message but get a different one:
The ValueAxis_Primary.Maximum expression for the chart 'DataBar2' has a nested aggregate that specifies a dataset scope. Inner aggregates cannot specify a dataset scope.
It seems to be telling me that I cannot have the denominator of the fraction for the City data bar specify that its scope is the dataset "StateDS", which is the dataset that aggregates by State alone. But I am confused. I don't understand why that would be. And I don't understand what I need to do to make it aggregate by state anyway.
Thank you.

How to get total from another tablix column? (SSRS)

Hello awesome people of stackoverflow!
I need help with a simple problem with my SSRS expression.
How could I do this in SSRS?
As you can on the 2nd table below in my excel screenshot.
for each row we divide -BC5...-BC10 to column/row BC4. To get the desired results for table 2 in excel column total 2018 into column/rows BC17 upto BC22.
I've tried referencing my textbox like this
ReportItems!TextBox1.Value / ReportItems!TextBox2.Value.
But got me the wrong values.
Can someone please help.
Thank you!
If those two tables are in the same table/tablix then it should work with the expression that you wrote (try to type it instead of copy paste sometimes that may work).
=(ReportItems!Textbox7.Value /ReportItems!Textbox1.Value) * 100
If they are not in the same Table/Tablix then you should write like the following:
=(Fields!ColumnName1.Value / Fields!ColumnName2.Value) * 100
Format your cells.
There is not enough info to give you an exact answer but you should be able to work it out.
The first thing you need to do is get the context of the aggregations you want to work with. So click on the cell containing the number you want to divide ([Sum(DiscountOERestated)] ). In the row and column groups panel near the bottom on the screen, look at the row group that is highlighted. For this example I'll assume the row group is called grpCategory.
Now we need to do the same for GrossCatalogRestated. However, GrossCatalogRestated in the top tablix does not appear to be an aggregate. I'll assume it should be the total GrossCatalogRestated for the dataset. For this exmaple, we'll say the dataset name is dsMyDataSet. If it's within a row group, just swap the dataset name out with the row group name that it sits in, just like we did for DiscountOERestated .
So you expression would look something like
=SUM(Fields!DiscountOERestated.Value, "grpCategory") / SUM(Fields!GrossCatalogRestated .Value, "myDataSetName")
This will give you a deicmal result, somehting like 0.025 . You then just need to set the format property to say, "p1", so it shows as 2.5%
If this does not work, edit your question to show the expressions in the cells you are working with along with the rowgroup and dataset names.

Totals in Matrix in SSRS

data in SSRS shows like this as below using the Matrix -
Can someone please help me how to get the totals for BB-1,BB-2 ,AC-1 ,AC-2 below for all the countries.I am using the running value function between the dates Aug-2015 and Jan 2017 for Columns BB-1,BB-2,AC-1,AC-2.
Type A always belong to BB-1 & BB-2. Type B belongs to AC-1,AC-2.
row groups-
Country
Type
Column Group
Date
It sounds like you want to create a secondary matrix that displays the information with a different grouping entirely. It is possible to have two matrix/tables that use the same data, and that's how I would go about solving this.
Amend the report design to the following:
Amend you report design, underneath main report add in another row group [Names], adjacent below, along with a sum(Value) field to look like this:
Report should like this:
Amend the report design to the following:

Need Savings totals by month to pull data correctly and display in Chart

My data and this SSRS chart have a ton of problems, I'll try to keep my question(s) succinct.
First, as you can see by this chart and this screenshot of my data (just showing date and April Savings), my expression/chart is not summing all of the savings within a month, which is my goal.
It appears to be picking one amount within the correct month and using it. I set up a tool tip for April so I could see what number it's pulling (since clearly the chart columns are not representing the data whatsoever - another issue).
You'll see in the SQL data screenshot that it does indeed pull $1,230 from the April 2013 Savings. How can I get this to Sum within the month AND still do a running value from the beginning of time data began to current, this often will include multiple years.
Here's my Chart Data (note that my Team Goal works perfectly, and is even charted correctly - but if anyone knows how to force that line to go from end to end on my chart, feel free to let me know.) :
To summarize, how can I sum each month's data, while still do a running value across the months AND years?
Here's my Expression for Implementable Savings:
=RunningValue(Sum(Fields!ImplementableSavings.Value), Sum, nothing)
(obviously if I can get one working, I can get both)
My Expression for ImplementedSavingsMonth:
=MonthName(Month(Fields!ImplementedSavingsDate.Value))
My Expression for ImplementedSavingsYear:
=Year(Fields!ImplementedSavingsDate.Value)
Let me know if there's anything else I can provide.
Quick sidebar question: WHY does my chart column collect one piece of data. IE: see the tool tip $1,230 for April 2013), but the chart column displays that the number is around $1.7M? And in this scenario, both of my blue and yellow columns are displaying the same number, so why does blue always appear to be a higher number? I will ask this as a 2nd question if it's inappropriate for me to ask here.
I would use this Expression for Implementable Savings:
= RunningValue ( Fields!ImplementableSavings.Value, Sum, "Chart1")
.. assuming your Chart's name is Chart1.

SSRS - creating chart - overlapping year - end of year/start of next

I have to report on some data covering November, December of 2013 and Jan, Feb of 2014. I know how to chart over a calendar year but I'm struggling with this...any one know how i can chart this in nov,dec,jan,feb order???
cheers
You have to have some field available in your dataset or a calculation based upon a field/fields that orders them correctly. If you have something like yyyy-mm (ex: 2013-11) you can set the sort order of the category group within your chart. Leave the actual value as you want it to be seen, just change the sort order.
Here's a good blog post that (I think) explains exactly what you are trying to do: http://www.allaboutmssql.com/2013/06/ssrs-in-charts-how-to-sort-labels-on-x.html
Sort the data first by =Year(Fields!YourDateField.Value) and then by =Month(Fields!YourDateField.Value)
Thanks for the input... i found this Custom ordering of series field for stacked chart in SSRS08 TFS
so i manually changed the value value with a switch and then ordered A-Z
All good now
cheers