Link to home
Start Free TrialLog in
Avatar of Gabe Lebron
Gabe LebronFlag for United States of America

asked on

If statement in SSRS

Sorry I had to repost this question.. The expert replies to me at 3 am my time everynite and by the time i reply i have to wait till 3 am the next day for a reply, this will take a week..

I have a margin % field.  I need 2 if statements, One that Looks at the Margin % and if it over 50%  change it to 50%  or if it under 0% change it to 0%  

then i want a if statment that if it is changed, make it red..  

I used This
=IIF(Fields!Margin.Value > 50,50,IIF(Fields!Margin.Value < 0,0,Fields!Margin.Value))
but it did nothing (see how it wont move the percent down to 50 if its over 50.. it just shows the same number
User generated image User generated imageNow the margin field I made and caluclated using two other data sets .. and formated with p (for percent) User generated image
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

And you sure that the value is between 0 and 100? Shouldn't be between 0 and 1 (0,5 for 50%)?
SOLUTION
Avatar of sureshbabukrish
sureshbabukrish
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gabe Lebron

ASKER

this is the raw data without the P  

 User generated image
I amasuming 50 is wrong
should i be using .50  instead of 50
yes , exactly
did it work?
That was I told before. 0.5 for 50%
yup using this wroked perfect.. and i can add the p format with no issues
=IIF(Fields!Margin.Value > 0.5,0.5,IIF(Fields!Margin.Value < .00,.00,Fields!Margin.Value))

Now i wanted to format these line in red if they were changed ..

I wanted to add an expression to the color field in properties.

Would it be some what the same.. i wanted to do black , red
Check in the color properties of the field.
yes .. but   what do i need to add to the if statement

=IIF(Fields!Margin.Value > 0.5,red,IIF(Fields!Margin.Value < .00,.red,Fields!Margin.Value))

?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
worked great thank you