Rounding Off in SSRS field - reporting-services

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.

Related

Add Percentage symbol in SSRS column's expression

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.

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

How to Display Only 1 Value Label in SSRS 2012 Calculated/Derived Series?

I have been using SSRS 2012 (Sql Server Reporting Services) with SQL Server Report Builder 3.0 (11.0.2100.60) to create Column charts that display columns for each day/week/month and display a trend line based on the mean across all days/weeks/months.
However, although the calculated series reflects only 1 value (the mean across all days/weeks/months), value labels appear on the chart displaying the single mean value for each day/week/month - that is, 3 days will result in 3 value labels for the same mean value.
Is there a way to force the series to show only 1 value for each mean trend line?
See below for sample chart.
The work-around I ultimately settled on involved creating duplicate series with value labels but invisible data points (obtained by setting Color to "No Color").
The values for this series are only assigned if the "dayofweek" field matches the first "dayofweek" field in the dataset, so only 1 data label will be displayed (namely, the first one).
For example, to show a single value for the average of the "physio" field for physiological alarms within my dataset ("techphysDayofWeek", I use the following formula):
=IIF(Fields!dayofweek.Value = First(Fields!dayofweek.Value,
"techphysDayofWeek"),Format(( Avg(Fields!physio.Value, "techphysDayofWeek") /
Parameters!StartDate.Value), "##.#"), "")
I wish SSRS provided an easier way, but after struggling with this seemingly simple issue for hours on end, I'm just glad to have any fix!
You can set the label text to be based on a formula. In that formula you could look at the value of the grouping field, and set the text to an empty string if it's not currently the group you want to have the label on.

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)

Microsoft Access automatically rounds numbers

Under a column that has a number data type. I am trying to enter the number 11.50, but the system is automatically changing it to 12.00.
because this type numbers can handle only numbers with out any fractions
you must change this datatype to be double
There are two settings for Number fields Field Size and Decimal Places. At first, you should change Field Size from Integer to either single, double.
When you have the table open in design mode, click on the field in question. In the lower pane you will see properties of the number, change the field size to either Single or Double.