Search code examples
reporting-servicesssrs-2012reportingservices-2005

SSRS Format changing values


In SSRS I am using an Expression to format a field as either an integer or Currency depending on an indicator I am passing in called NumFormat.

This is the expression I am using

=IIF(Fields!NumFormat.Value = "C", FORMAT(Fields!Antaco.Value, "C"),
FORMAT(Fields!Antaco.Value, 0))

The problem that I am having is that when I apply the expression it is changing the values that are being displayed (which are all numeric(10,2) from SQL

for instance before applying the expression I would get a value of 7319930.40 for one of the values.

that same row shows $7319937319930.44 when the function is applied.

I have tried doing a convert to CDEC before applying the expresssion but that didn't help.


Solution

  • I suggest you don't format the number directly. Instead, set the Format property of the cell to an expression such as

    =IIF(Fields!NumFormat.Value = "C", "C", "F0")
    

    The table cell can then simply be the Antaco field value.

    If you need thousand separators use N0 instead of F0