SSRS hidden columns expression consuming time while rednering - performance

I am converting one crystal report to SSRS In which There are multiple group header having expression like
IIF(Fields!MainGroupOrder.Value = 2 And Fields!DaysOrHours.Value =
"Hours",IIF(Sum(Fields!Count_01.Value) = 0, 0,
Sum(Fields!Jan_CountTurnTime.Value)/Sum(Fields!Count_01.Value)/60),IIF(Sum(Fields!Count_01.Value)
= 0, 0, Sum(Fields!Jan_CountTurnTime.Value)/Sum(Fields!Count_01.Value))/60/9)
There are 12 such statements in each row with 5 rows
This row with 12 columns has visibility condition at row level
When I am viewing report after removing these expression, Report is taking 37 seconds to render
With same parameter when I am rendering report with these expression It is taking 1 minutes and 20 seconds (these expressions are not visible with given parameters)
I read somewhere that SSRS after 2005 does not calculate hidden column till its not used in any other visible condition
Then why time is increasing on inclusion of these expression even though these are not visible and also not used in any visible condition
Can you explain why and it would be great if you can help me in decreasing the time this report is taking due to these expression which are not visible
Thanks

In SSRS, every expression takes time to evaluate. Even invisible objects complete all their calculations. You can easily test this by making everything invisible, it doesn't save any time.
Here are some general tips to make SSRS reports faster:
Optimize the original query.
Cache the report beforehand.
Do more of the calculations in the SQL as opposed to in the report.
Use a stored procedure instead of plain SQL.
Use parameters to filter the query to just the data you need as opposed to filtering it in the report afterwards.
Use a calculated field to consolidate logic that is used in multiple places in the report. This way, the calculation is only done once per row.

Related

SSRS 2012 total of a percentage measure

I have a percentage measure calculated in SSAS tabular and its correct.
But when i use it in a report i face the following problem (in all percentage measures).
the values under male and female (which are subgroup of saudi and non-saudi) are correct but if you look at the total under "Both sexes" it is incorrect,because it shows summation of male and female percentage, where the right thing is it shows the percentage of the saudi or non-saudi.
If i calculate the measure in SSRS in the expression fields i get it right as follows
But i want to use the measure to show the right values.
So.. can anyone help me with this i have serious issues in later reports and i just cant simply recalculate the SSAS measures in SSRS using expressions.
Note: dont mind the decimal places differences between the two pics.
Thank you.
You can change your MDX query in SSRS to return the subtotal rows then change your Textbox formulas in the body of the Report to say =Aggregate instead of =Sum. This process is described more here by Stacia. You can use manual MDX queries. Don't miss the comment at the bottom:
Romuald Coutaud March 17, 2011 at 7:52 pm Hi Stacia,
In fact, it works in query mode too in 2008R2. But, I have to admit
that the way that RS and AS work together when you want to use
aggregate function is very difficult to perfectly understand and I
have struggle very long time to make one sample report running in this
way. In query mode you need to write MDX by referencing each level of
the hierarchies from the top one to the deepest one want to display in
your report, even you don’t need to use all these ones. As an example
you have to put Year, Quarter and Month to be sure to display Month
and be able to use aggregate function.
Basically in your report =Aggregate will try to retrieve a row where Nationality is not null and Gender is null. If you get stuck please write back with the list of each field used in each group in SSRS and a screenshot of the MDX query designer.

SSRS Matrix Variance Column - Report Running Slowly

I am creating an SSRS Report based on a Stored Procedure; the procedure calls in the last six months of data based on the month the user enters into a parameter (ex. 201604). Currently I have this data going into a matrix, and along with those six months the report needs to have a variance column for the latest vs. directly prior month (ex. 201604 vs. 201603)
Right now I have a formula that works using a column that I created within the stored procedure to designate whether the month a row is in is CURRENT, PRIOR, or NONE if it is not being used in the calculation.
=SUM(IIF(Fields!VarHelper.Value = "CURRENT",1,0) * Fields!stock_value.Value
-
IIF(Fields!VarHelper.Value = "PRIOR",1,0) * Fields!stock_value.Value)
I am using this formula in three areas/cells on the report, and for some reason it is causing the report to run very slowly (around 45 seconds to run). Without these variance formulas in the report it runs almost instantaneously.
Would someone be able to either a).suggest a better method of calculating the variance between the latest two months in a matrix, or b).be able to at least shed some light on why this may be impacting report performance?
Thank you in advance!
Try to report the calculations on the query.
Two ways possible : if you made a sql query : make it in the select.
Or, add calculted field in the dataset.
And make sum on these fields.
May be you will win time : because the database server will make the job instead of the report server.

How can I get the values in the Matrix on my SSRS report to repeat?

I know there must be a simple answer to this, but I can't find it.
I have added a couple of textboxes to a Matrix in a BIDS/SSRS report. I've given these textboxes values such as:
=Fields!WEEK1USAGE.Value
It works (after a fashion); when I run the report (either on the Preview tab, or on the Report Server site) I see the first corresponding data value on the report - but only one.
I would think that once a value has been assigned via expressions such as "=Fields!WEEK1USAGE.Value", each value would display (rows would automatically be added).
There must be some property on the Matrix or the textbox that specified this, but I can't see what it might be.
Here is how my report looks (very minimalistic, so far) in the Layout pane:
...and after running, on the Preview tab:
Obviously, I want the report to display as many rows as necessary, not just one. The textboxes do have a "RepeatWith" property, but there description doesn't sound interesting/useful/promising.
I don't see any property on the Matrix control that looks right, either.
I thought maybe the designer was only showing one row of values, and ran the report on the server, too, but there also it just shows the two values.
So what do I need to do to get all the data for a provided field?
Matrices are for display of grouped data and summary information, usually in a horizontally expanding pivot table type of format. Is a matrix really what you are after? Looking at your expression you have =Fields!Week1Usage.Value but in a matrix what I expect to see would be at least =Sum(Fields!Week1Usage.Value) or even better just =Sum(Fields!Usage.Value). Then you would have ProactDescription as your row group and the week as your column group and it would all just work out everything for you, grouping and summing by Proact vertically and expanding the weeks out horizontally.
What seems to be happening is that you have no grouping on rows or columns and no aggregation so it is falling back to the default display which is effectively the First function - it displays the first row of data and as far as the matrix is concerned it has done its job because there is no grouping.
Without knowing your problem or data, I'll make up a scenario that might be what you are doing and discuss how the matrix does the heavy lifting to solve that problem. Let's say you have usage data for multiple Proacts. Each time one is used you record the usage amount and the date and time it is used. It could be used multiple times per day but certainly multiple times in a week. So you might be able to get the times each Proact is used from a table like so:
SELECT ProactDescription, TimeUsed, Usage
FROM ProactUsage
ORDER BY ProactDescription, TimeUsed
In your report you want to show the total weekly usage for each Proact over multiple weeks. Something like this:
Proact Week1 Week2 Week3 ...
Description Usage Usage Usage ...
--------------------------------------------
Anise, Fennel 1 CT 20.00 22.50 16.35 ...
St John's Wort 15.20 33.90 28.25 ...
...
and so on. Using a dataset based on the SQL above we create a matrix and in the row group properties we group on =Fields!ProactDescription.Value and in the column group properties we group on a week expression like =DateDiff(DateInterval.Week, Fields!TimeUsed.Value, Today) and then in the intersection of the row and column we put =Sum(Fields!Usage.Value). To display the header of the column nicely put an expression like
="Week " & DateDiff(DateInterval.Week, Fields!TimeUsed.Value, Today)
The matrix automatically does all the summing by week and product and expands the weeks horizontally for as many as you are reporting. For bonus points you can also put totaling at the end of the columns and the rows to show the total use of that Proact for the period (row total) and total use of all Proacts in that week (column total).

Can I receive data from .rdlc Report Parameters?

I have a VS 2010 Report, and I would like to pass values that are calculated inside of one .rdlc report to another. Can I somehow use the Parameters to send data back out of the report, or have some "return" value from the .RDLC?
I don't think you can have return values with report services.
Instead, assuming that the two report have different dataset, the only solution I come out so far is to include two dataset in your second report and recalculate your field.
Doing that, you can use your normal expression to calculate the values that you need from the first report specifying the first dataset.
Here really simple example:
Report 1
The report is using only the DataSet1
=Fields!AField.Value
Report 2
The report is using two dataset: DataSet1 and DataSet2
=(Fileds!AField.Value, "DataSet1") + (Fields!AnotherField.Value, "DataSet2")
Ofc the expressions could be more complex, but the most important thing is to specify the DataSet where the report have to take the filed.

Visual Studio 2005 table rendering order

I'm working in Visual Studio 2005 Reporting and I'm trying to implement a workaround of nesting aggregate functions (I need to perform a Count of Sums). In the table details row, I have a call to custom code to increment an integer every time the value of one cell is >10, then the footer has a call to a custom code function that just returns that value.
The count was always returned as 0, so I threw in some MsgBox calls and noticed the table footer is being called before the details rows. I need the table details rows to be called first so that the "get" function in the footer will actually retrieve the value I need.
To be more specific, I'm looking to count the number of times a given table cell, whose value is calculated as (Sum / (Sum+Sum+Sum)) * 100, is greater than 10. Since aggregate functions can't be nested, and the use of aggregates on ReportItems!... can only be done in report headers/footers (in my case not helpful as it will display a different total on each page), I'm left with the option of custom code.
Is there any way to force the details row of a table to be rendered before the table footer?
Instead of using the table footer, I used a textbox beneath the table, so the table was rendered first, header and details rows, then the report processed the textbox below, leading to the correct value.
Hope that helps anyone that comes across this issue.

Resources