Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Format of the Format Property Problem

Status
Not open for further replies.

scoobyroo

Programmer
May 10, 2007
47
US
I am new to conditional formatting the format property and maybe I can't do what I am trying to do.

I have a stored procedure that contains a type field and monthly values which are formatted as money. In SSRS, I need the format property to look at the type and decide which type of formatting the number needs.

For example:

if type = % Difference, I want to format as percent with no decimal places
if type is anything other than % Difference, I want to format positive numbers like #,##0 and negative numbers like (#,##0)

I have tried many combinations in the format property expression, but this is the only one that gets me close.

=iif(Fields!Type.Value = "% Difference", Format(Fields!M2.Value, "P0"),
iif(Fields!Type.Value <> "% Difference" and Fields!M2.Value < 0, Format(Fields!M2.Value, "(#,##0)"),
iif(Fields!Type.Value <> "% Difference" and Fields!M2.Value >= 0, Format(Fields!M2.Value, "#,##0"),"")))

This formula does something strange with my numbers though. For example, one number should read 24,852,000. However, what actually shows up is 24,852,24,852,000

Any help would be greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top