Sparkline based on Expression using custom code - ssrs-2008

I have an SSRS report which is reporting sales grouped by Month. One of the columns in this report is a calculated fields which takes 2 values and passes them to a custom code routine that is defined for this report. The textbox that is populated with the following code:
=Code.DivideBy(ReportItems!textbox21.Value, ReportItems!EarnedIncome1.Value)
All this Custom Code does is to divide the First Parameter by the Second Parameter (in this case whatever is in textbox21/EarnedIncome). The response is them shown on the screen as a percentage.
Below is an example of the report:
1 http://www.propelpos.com/images/screenshot002.jpg
This worked great. What we are trying to do now is to graphy the % that is in the BDX Loss ratio column which is figured out by the formula above (dividing Losses by Earned Premium)
When I try to copy the expression in the chart data and set the Category Groups to PeriodYearMonth (same as all the others), then I get a straight line.
I have no idea where to go next. Any ideas would be much appreciated.

I agree with #Neil. You can also Add the Calculated field in you data set properties. Take a look at the following screen. You can set the expression to calculate the data for your line chart.
Hope this helps!

I would suggest doing the calculation in your query and then using that computed column in SSRS. If you need help figuring out how to do that, let me know.

Related

Cognos Report Studio - Grouping/Filtering

Truth be told I'm not entirely sure what it is I'm trying to do here, well, that is I know what I want to achieve, but not how to go about it... so here's hoping you can help point me in the right direction!
I need to create a Crosstab report which has customers down the side, dates for columns, sales for figures. Simple enough.
Where it gets tricky is that they then want another row beneath the customers which singles out two customers, and their sales for one particular product.
They then want another row which will remove that figure from the total of the overall sales total for the first section (see example image).
I'm not really sure where to even start with this. I think I may need to use a query union, but every time I start I get kinda stuck... help!
That's not a crosstab. The summary calculations don't work. It's probably going to end up being three crosstabs formatted to look like a single crosstab. The first crosstab is everything down to the Total line. The last two lines are each crosstabs. Set the Size & Overflow, Padding, Margin, and other formatting properties so everything is layed out, bolded, and shaded the way you want.
You can create this as a crosstab
If you are okay with setting each customer as a fact
You can add them to a crosstab in any order you want
Then you can create a new data item and use a conditional statement that sets the metric to be the specific customers the consumer wants
For example,
IF([Customer] IN(?PrmCust) Then([Sales])Else(0)
For the revised total, unlock the report and replace them with layout calculations that take the total and reduce it by the amount of the selected customers

RDL is taking very longtime to render the report

In my report, I have 1 Tablix and 40 columns, i am simply dumping my data into the report, Scenario is as follow:
First row is for heading of the reports.
In Second row, i have data bound columns.
In third row, SUM expression.
I have some 5000 rows in my data table, This scenario is taking around 18 seconds to render the report.
Now the problem is that I need to apply colors dynamically eg.
=iif(CellValue >= 0 , "Black","Red") to all of my columns. as soon as i have applied this expression, report took around 5 mins to render.
Kindly share you expertise.
Regards
Inderjeet Singh
Sometimes SSRS has a bit of trouble doing lots of calculations during rendering. One thing to try is to have this calculation done as a column in the SQL if you can. Then simply refer to this field to determine the color. If you can't do that, add a calculated field to your dataset so that the calculations are done at a higher level than cell-by-cell. That usually helps too.
Based on my personal experience I have found that adding filters within SSRS tends to slow it down. Based on your dataset though it should not have much problem.
Additionally, if you have a grouping set to display pages on a single page (i.e. Keep together) that will slow it down as well.

Is it possible to sum the expression column in SSRS

I am stuck in a scenario where client needed to do sum of column which is containing calculated values(Expressions) which are calculated at the run-time (At the time of generating report).
I suggested client to calculate this column at database side and return this column to SSRS dataset but due to some circumstances it is not possible.
Any help on this will be greatly appreciated.
Thank You
I don't have comment access So Iam not able to ask you more details. You can SUM up the calculated expression in SSRS AS you didn't mention how it looks.I am getting one example.
If this is how your normal cell of calculation looks,
=Fields!FirstCol.Value+Fields!SecondCol.Value
Then the SUM can be
=SUM(Fields!FirstCol.Value)+SUM(Fields!SecondCol.Value)
And if you added the calulatedColumn in the Dataset itself then it becomes more simple as you just have to do as,
=SUM(Fields!CalculatedCol.Value)

SSRS Aggreation on Calculated Field

I am trying to perform an aggregation on a calculated Field in SSRS and am getting the following error:
[rsAggregateReportItemInBody] The Value expression for the textrun 'Textbox43.Paragraphs[0].TextRuns[0]' uses an aggregate function on a report item. Aggregate functions can be used only on report items contained in page headers and footers
This is the formula I tried to use:
=Sum(ReportItems!PlanPurchPrice.Value, "Select_UCPUtilization")
In this Case PlanPurcPrice is also an Expression:
=First(Fields!PawPlanPurchPrice.Value, "Select_UCPUtilization")
Any suggestions on this would be greatly appreciated.
SSRS 2008 does not support the functionality you are looking for unless the report item is located in the header or footer (as is stated in the error message). I would, instead, propose two alternate solutions:
First Option
Place the calculation in your query (if possible) at which point you can then reference the field and the aggregate will work as desired.
Second Option
You essentially want to create the aggregate you're looking to return elsewhere in the report where it is directly connected to the Select_UCPUtilization scope, then reference the aggregated value elsewhere. Follow these steps:
Within the same scope as report item PlanPurchPrice, calculate a sum of the PlanPurchPrice. Name the textbox containing the aggregate something meaningful (e.g., Sum_PlanPurchPrice).
Reference that textbox directly wherever you were trying to use the ReportItems sum before (i.e., =ReportItems!Sum_PlanPurchPrice.Value)
Hide the workaround. Place the aggregate you created in an additional column or row attached to the Select_UCPUtilization scope. Turn the text white, turn off growth and shrinkage, and make the row very tiny (a pixel or two high).
Using the second option, the report item does exist (and is visible, which is important) on the report and contains the sum you are looking to return elsewhere.
Hope this helps. if this doesn't make sense, please reply via comment and I'll help you to the best of my ability.

How to calculate cumulative field values in report

I am new to JasperReports and iReport, and I am facing a problem. Before going through the question, first, please take a look at the following image:
So, the main problem is with the cumulative columns. Per say, the "Cumulative Bill" column should show the following values sequentially:
6000.0, 14000.0, 23000.0, 32800.0, 42800.0 and 45800.0
I have no idea how this can be done. I tried creating a new variable, but there is no cumulative type calculations there. Please assist me.
Create variable $V{variableName} with calculation = Sum and Variable expression = $F{BillAmountField} and put text field with this variable into detail section.
Is it so hard? :)
It can be done at the query level, here is the query :-
SELECT m.bill_amount,
#cbill:=#cbill+ifNull( m.bill_amount,0) cumulative_bill
FROM (
SELECT #cbill:=0,
bill_amount
FROM
)m