SSRS conditional number formats - reporting-services

I have a report that shows an opening balance. If the balance is zero then I want to the number format #,0.00 to display as 0.00. However, if there is a credit then I want the number format #,0.00 C to display as, for example 123.45 c
I'm thinking it's some kind of Switch expression but for the life of me can't get it working.
Thanks in advance.

Set the format property to the expression below
="#,0.00;#,0.00c;0.00"

Related

Formatting number by 0.## in report server

I'm encountering an issue that bothers me a lot for days.
I've been searching online via 0.##, #.##, number formatting, etc., but with no conclusion
I'm setting up a report in report server and there's a column called 'account available',
which might has a number like 123; ;123.4; 123.45; 123.4567; 0
My way to create a formatting rule is 0.##; 0.##; 0
123-->123. I DON'T WANT this formatting, I would like it to be 123
Below are all good, i'm very satisfied with these formatting.
123.4 --> 123.4
123.45 --> 123.45
123.45670 --> 123.46
0 --> 0
is there any kind person who would like to guide me to modify this issue? thanks a lot in advance!!
This issue is a bug in Excel.
The number renders fine in SSRS but if you apply the same format string to a cell in Excel 123 is returned as 123. as you found out.
To get around this bug in Excel you have to use an expression to set the format based on if the number is an integer or not. When exported to excel this displays as expected.
You can use an expression such as this in the format property.
=IIF(Fields!myNumberField.Value = CINT(Fields!myNumberField.Value)
, "0"
, "0.##; 0.##; 0"
)
In SSRS it looks like this...
When Exported to Excel it looks like this
In both images, the left column is the unformatted data and the right column has the format expression applied.
Finally:
This bug is mentioned in several places but I'm not sure if it has been reported - it may be worth checking and reporting it yourself.
Excel number format to only show decimals when necessary
https://superuser.com/questions/1645944/number-format-excel-bug

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"))

SSRS 2008 Time Format for a chart. does not work

I have an ssrs chat, I want to bind time valeus to y axis.
Data comes in "2013-11-21 16:07:31.000" format
I need 16:07 value as time. but no function give me that.
when I use cdate, and then Format it does not work . HHmm returns me an inteeger 1607 bur HH:mm doesnt work.
please help I am about to go crazy!
Try leaving your value, or setting up a calculated field that just uses =CDate(Fields!AverageTime.Value) or =DateTime.Parse(Fields!AverageTime.Value)
Then, I assume you use that date field as a category on your graph. Set the format on the X axis to HH:mm as shown below. Let the graph handle the display using format strings, don't use the Format function.

Use a summary field in an expression in SSRS reports

I have the details of my report being summed up in a summary expression, all works fine. The fields are decimal values of hours worked. Thus, the summary value is also a decimal value. I'd like to access the summary value and convert it to hours / minutes. I've labeled the express as "WorkTimeSum", but can't seem to get a handle to it, however. Fields! obviously won't work since it is a summary expression. I was thinking ReportItems! should work, but to no avail. How can I use this expression field (in a summary row) in an expression in the same summary row?
If I've understood correctly, you're asking how to reference the textbox containing the total work hours value so that you can convert it to hours and minutes using an expression in a different textbox?
You can use either ReportItems! e.g.
=ReportItems!Textbox20.Value)
or ReportItems("") e.g.
=ReportItems("Textbox20").Value
to reference the value of another textbox. Be careful with the names as they are case sensitive.
You can use aggregate functions in any expression. For example, in any header rows you can use the following expression to determine the total hours value:
=Floor(Sum(Fields!hours.Value))
Sum(Fields!hours.Value) is just the total hours in whatever context, e.g. the group total if it's a group header row; you can use this expression as an input in any other expression you require.
It sounds like your issue wasn't the conversion itself, so hopefully this points you in the right direction. If you need further information please specify.