Add Percentage symbol in SSRS column's expression - reporting-services

I have a column in which for all the values of column I need the percentage symbol in the end. So what should I put in the expression for this.
Like currently I have in the expression ->
=Fields!Contribution_Margin_.Value
To get this '%' symbol in the end what should I do? All the calculations I have done at the backend so only the symbol is required.

If your column is a decimal number that represents the percentage you can just use the format function to format the number:
=format(Fields!Contribution_Margin_.Value,"0%")
Or if you want to keep the value as a number within the report, you can set the Format number property of wherever it is displayed:

It depends on how the number is stored.
Let's say you have a value that needs to be shown as 12.5%
If the value stored in your dataset is actually 0.125 (this is the correct way) then all you need to do is set the format property of the textbox to p1. The means "format as percentage to 1 decimal place"
If your dataset value is actually 12.5 then you can set the format property to something like
0.0 "%" to show to 1 decimal place or
0.00 "%" to show to two decimal places etc.
Alternatively you could just divide the value by 100 to get back to a "proper" percentage value and use the standard formatting codes as shown in the first example.

If all you need is to add % symbol; just add the % symbol in the same textbox as your placeholder, not in your expression.

Related

Rounding Off in SSRS field

In one of my columns in SSRS, I have the expression as
=ROUND(Fields!Contribution_Margin_.Value,5) & "%"
As you can see I am hardcoding the percent symbol after rounding off the value till decimals. But the issue is that the user wants to see only 2 decimals in the SSRS report and when he export it to excel he want 5 decimals while clicking on that particular cell.
So I went into Text box properties and in the Number section, I rounded off to 2 but it is not happening as I am having the "%" symbol, in the end, so after this also it is giving me till 5 decimals in the report.
Any solution how to make it to 2 decimal places in SSRS.
Don't mix value and display - leave the value as is (instead of turning the Value property into a string with the format hard coded into it, thereby losing precision and type) and use the display properties to show that value in the precision required.
Make the cell value just be the field value: Fields!Contribution_Margin_.Value. This allows it to be exported as a number rather than text.
Set the Format property of the cell to display percentage to two decimal places: p2
When exported to Excel, the full field value will be there and the client can format it to 5 decimal places.

SSRS % Number value positive or minus value to see if its possible to display the word 'increase' or 'decrease' automatically

I am using SQL Server Reporting Services 2016, I need some advice on the following statement I have in the top row of a Tablix in SSRS inside a textbox, the stament has a few expression within the text:
The total number of referrals received so far in this reporting period
is 1427. This is a -6% «Expr3» when compared to the 1518 received in
the same period of the previous reporting year.
In this example I would like «Expr3» to say "Decrease" because -6 is a negative number.
«Expr3» ---The issue I have is I need to work out <>, I would like to display either Increase or Decrease based upon the value of «Expr2», if «Expr2» is a positive number then I want this value for «Expr3» to show the word "Increase" and if «Expr2» value is a negative number then I want «Expr3» to show "Decrease".
Below my value behind the other expressions
«Expr1»
=Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod")
«Expr2»
= ((Code.Divide(
(Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod"))
,
(
Sum(Fields!ID.Value, "02_TotalReferralsInLastPeriod"))
))-1)*100
Is there an expression which can do this for me?
Thanks
Your expression for Expr3 should be something like this:
=IIf(
((Code.Divide(
(Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod"))
,
(
Sum(Fields!ID.Value, "02_TotalReferralsInLastPeriod"))
))-1)*100
>= 0,
"Increase",
"Decrease"
)
This expression assumes that you want to include 0% as an increase, that can of course be changed to fit your needs by modifying the >= 0.
If you are going to have the word "increase" or "decrease" after the percentage though, you may want to display the absolute value of the percentage -- this may just be semantics but it would be a little confusing to me to see a "-6% Decrease", as the double negative implies an increase. If you wanted to change that, just wrap Expr2 in the abs function like so:
=Abs(
((Code.Divide(
(Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod"))
,
(
Sum(Fields!ID.Value, "02_TotalReferralsInLastPeriod"))
))-1)*100
)

How to specify percent in Access Form without multiplying by 100

I have an Access form that I want to show a percentage in. The data is coming from a SQL backend and is an Int. Whenever I set the Format for that field in Access to be Percent it multiplies the value by 100. I just want to add the % sign behind the value. I've tried a custom format like 0\%, but that doesn't work. Access removes the \ and considers it to still be set to Percent.
How can I format the number to have a % added to the end of it without multiplying it by 100?
Update
If I try to change the Data's Control Source to be =[Source]/100 i get an error like this:
I assume you are trying to do this on the Control's Format property. If so, try this: #%
Bind your textbox to:
=[YourIntegerField]/100
and set the Format property to: Percent

Format a column with percentage using VBA

I am exporting a report to Excel from Access through VBA. There is a column in the report that should be formatted as percentage and round. How can I format this?
Set the Format property of the textbox in the report to: Percent
You may have to divide the value by 100 first. If so, rename the textbox to anything else than the name of the field, and use this expression as ControlSource:
=[YourFieldName]/100
For a new formatted string value, use Format:
=Format([YourFieldName],"Percent")
You don't mention what kind of rounding you need, but functions for all general methods of rounding are listed here: Rounding values up, down, by 4/5, or to significant figures

Format Numbers in Multiple columns of SSRS Report

Currently I am working on a ssrs report. The table in report is having about 30 columns. For each column I have to modify the number format (to either 2 decimal or no decimal numbers). I can do it by click on every column and modify the number property in format menu. But is there any way to format all the columns at a time?
I tried to select entire row -> F4 -> properties -> Number -> Format-> Expression. And set expression to:
=FormatNumber(Fields!HoursWorked.Value&Fields!ContactAttempted.Value&Fields!UnableToContact.Value,2)
But it throws an error
Type character '&' does not match declared data type 'Object'.
Can any one help me on this?
This is really, really stupid; you have to have spaces before and after the ampersand, and if you don't then you tend to get that error message. I don't know why, it's daft as hell but I bet that's it. Catches me out constantly. Try:
=FormatNumber(Fields!HoursWorked.Value & Fields!ContactAttempted.Value & Fields!UnableToContact.Value,2)
If you want to set the Format property of a cell (or cells - note you CAN set the format for multiple cells at the same time) then you need to specify a value or expression that resolves to a recognised format string, e.g. '$'0,.00;'$'-0,.00 or C2.
The expression you have given returns the actual formatted value of the cell, so this will not work if entered into the Format property - this needs to go in the Value property of the textbox.
You need to set format number for each column separately. If you don't want to set number format in Text Box Properties, you can set format such way:
Click on cell with value -> F4 -> field Format in Properties -> set format (for example, you can use this format: #,0.00 for numbers with space as 1000 separator and negative numbers as -12 345.00)