Format Numbers in Multiple columns of SSRS Report - reporting-services

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)

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.

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

Microsoft Access formatting: Need format to display either Date or "0". 0 keeps displaying as 12:00:00AM, how to fix?

I need to make it so that the one field either displays the Date or the value of 0. They're two separate formats, and so I can't get Access to mix the two up. Logic functions keep displaying errors for me.
You can do conditional formatting like so as a "custom" format:
[=0] 0; [>0] mm/dd/yyyy;
[=0] checks if the value is zero, if so, the cell is set to 0. If it is greater than 0, use mm/dd/yyyy or whatever date format you like.
You can use Format. Rename your textbox to be different from the date field name and this as ControlSource:
=Format([YourDateField],IIf([YourDateField]=0,"0","yyyy-mm-dd"))

MS Access, number formatting

I need to display a number (real), ie 1234.567 like "1.234,56" or "1,234.56". I know that I have to use Format() but I can't figure it out. (It's for a textbox where the 'Control Source' property is set to some number field)
This should do it:
Format(number, "#,##0.00")
Where the actual separators used depend on the current locale setting.
Below method worked for me in ms access 2000-2003.
You should make changed in Table and in reports.
Table.
Go to the required field, Change data type to Nnmber, Field size to Decimal, Format to Standard.
Report.
Select the control where you want the thousand separator, select properties the format Select standard,, Decimal places 2.