How to subtract two textBoxes of ssrs report? - reporting-services

In footer I have 2 textboxes named curTotal and sub_total.
In header I have third textbox named result.
What I want to do is to subtract values of footer: result = sub_total - curTotal;
curTotal expression is (=sum(reportitems!lineamount1.value))
and
sub_total expression is (=Last(ReportItems!runningTotal.Value))
"runningTotal" is a field in tablix which has expression (=RunningValue(Fields!LineAmount.Value, SUM, "SalesInvoiceDS"))
I have tried to add to result expression following (=reportitems!sub_total.value - reportitems!curTotal.value) but it gives error that textbox refers to several report elements.
Please guide me how to correctly perform Math functions like subtract, multiple, division etc... with textBoxes in footer / header.

Unfortunately you cannot perform operations that combine ReportItems. Therefore the mathematics needs to take place at the appropriate row level using values derived from the data source and the results held in hidden fields at this level that can then be referred to using ReportItems.
So one approach would be to add a dummy outer grouping level to your report with a footer that you use to calculate these values. This footer line can be hidden and used as a source of ReportItems for your footer and possibly your header.
Also see http://www.keepitsimpleandfast.com/2011/09/running-totals-per-page-in-ssrs-to.html

Related

SSRS get value from specific row and column

What I would like to get is the Gross Margin % of the Revised Budget cell (11%) and place in a text box at the top of the page so it stands out a little more.
This is my current dataset output and also what is rendered in the table.
Header
Original Budget
Change Orders
Revised Budget
Contract Value
1000
0
1000
Labor
500
500
100
Gross Margin %
10%
10%
11%
I have tried using some IIF statements but that seems to only pull from the aggregate of the dataset and have looked at the LOOKUP function but that seems to only target a row.
Something I tried that isn't working - doesn't look right anyway
=Fields!Header.Value = "Gross Margin %" and Fields!Revised_Budget.Value = "Revised Budget"
If someone could point me in the direction of the correct function that would be great.
Running SSRS 2012.
Here is the report design
The row you need the value from is a group total, then you should be able to use the ReportItems collection and add a reference to actual textbox.
In your example, click the cell that you want to repeat (the one at the bottom of your report) and find its name from the properties panel, some like TextBox99.
Then in the textbox at the top, set the expression to
=ReportItems!textBox99.Value
That should be it.
I ended up using the Lookup function. The first value is name of the value from the Header column that I was looking for. The last value is the which data I want to return and that is the Revised_Budget value from the ProjectCosts dataset.
=LOOKUP(
"Gross Margin %",
Fields!Header.Value,
Fields!Revised_Budget.Value, "ProjectCosts"
)

How to generate numbers for showing sequence in SSRS also it should get rearrenge when any field inbetween is missing

I am facing problem in SSRS report for showing sequense numbers as given in image.
when I searched for this issue I got solution as -- RowNumber("DataSetName")
but problem with this is, it generate numbers like 1,2,3..., but I want these numbers in following forms- 1.1, 1.2 or 1.1.1, 1.2.1.
And another problem for me is above function will work if I am having multiple rows in dataset and that dataset is bind with table to show its data, but In my case I am getting all data in single row and out of that I am showing values in textbox using expressions and if that value is empty I am hiding that textbox.
so I am not getting any solution to show sequence number in textbox along with text and how I can rearrenge that numbers if my inbetween textbox is hidden because of no data.
Please provide me solution for above probem.
Image for reference -
Example of data is :
From above table values from "Subheading1" And "Subheading2" will show inside "Heading first" and "Subheading3" And "Subheading4" will show inside "Heading second".
You can concatenate row numbers as strings as follows:
=RowNumber("HEADING") & "." & RowNumber("SUBHEADING")
To ensure numbers are consecutive remove the relevant rows in the source dataset instead of hiding them in the tablix.

SSRS number format expression showing unexpected results

I have a table that contains metric data for various business units in our organization. There is one column that contains the KPI measurments. I've created a report to display each business units KPI's. Some of the metrics need to be displayed as whole numbers, others need to be displayed as percentages.
I created an expression to handle the multiple formats. The problem I'm having is with the percentages. For example one of the numbers (which should be displayed as 93.74%) appears as 939474%. If I remove the expression and set the format to percentage using the text box properties, the number displays as 93.74%.
Here is the expression I'm using:
= IIF(Fields!KPI_desc.Value like "*Rate",
Format(Fields!Value.Value,"0.00%"),"0")
Any suggestions would be appreciated.
Thank you
I guess you put this into the Format Expression so that it will return the result like integer. Actually you just need to put this expression into textbox directly.
= IIF(Fields!KPI_desc.Value like "*Rate", FormatPercent(Fields!Value.Value,2),"0")

SSRS - Changing tab name when exporting to excel

I have tabbed my report in SSRS 2012 by having my page breaks based upon grouping classname and it works great. How do I change the tab names when exporting to Excel? I tried having an expression for page name =Fields!classname.Value. In doing so, it makes all 4 of my tabs equal the first page break of Sales Division.
My tabs are based upon the grouping of classname, which in returns gives me the 4 tabs: Sales Division, VRS, ClearCaptions, and IP-relay.
You need to set the PageName of the Tablix Member (group), NOT the PageName of the Tablix itselfs.
If you got the right object, if will say "Tablix Member" (Tablix-Element in German) in the title box of the properties grid. If it's the wrong object, it will say only "table/tablix" (without member).
Also, be advised to set the sort order of the group expression, so the tabs are alphabetically sorted.
If you get the tablix instead of the tablix member, it will put the same tab name in every tab, followed by a (tabNum). That is exactly your current problem.
This solution was not working for me.
I had to add group break page.
https://www.mssqltips.com/sqlservertip/3527/export-sql-server-reporting-services-report-data-into-multiple-excel-worksheets/

Use multiple ReportItems in one expression in RDLC Report

I want to display page wise sum of 2 columns in footer.for that I am using following expression in footer
=Sum(ReportItems!col1.Value) + Sum(ReportItems!col2.Value)
but it gives following error
"The Value expression for the textrun refers to more than one report item. An expression in a page header or footer can refer to only one report item."
anybody knows how can I solve this issue and display page wise sum in footer ?
Thanks
Here is simple workaround for your problem:
Add single textbox to the body of the report and name it i.e. "SUM"
Add your expression to this textbox =ReportItems!col1.Value + ReportItems!col2.Value
For this textbox set visibility as hidden
In the footer refer to this hidden textbox using =ReportItems!SUM.Value
I usually use Custom code-feature of report for these operations. Just open Report Properties and choose Code-view. Just then write basic VB get/set-methods to save and sum values.
Referring to methods in TextBox expression goes just like this: =Code.[YourMethodNameHere].
For example, saving value:
=Code.SaveMyValue(Fields!MyVal.Value)
and getting value:
=Code.GetMyValue()