Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

If statement in SSRS

Posted on 2011-02-16
12
Medium Priority
?
911 Views
Last Modified: 2012-05-11
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
b cNow the margin field I made and caluclated using two other data sets .. and formated with p (for percent) a
0
Comment
Question by:gotti777
  • 5
  • 4
  • 3
12 Comments
 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 34914581
And you sure that the value is between 0 and 100? Shouldn't be between 0 and 1 (0,5 for 50%)?
0
 
LVL 9

Assisted Solution

by:sureshbabukrish
sureshbabukrish earned 1000 total points
ID: 34915313
Try initially with this

IIF(Fields!Margin.Value > 50,50,Fields!Margin.Value), see whether it works, if it works, then check for < 0.

Try removing format "p" and then check.

check this also - IIF(Fields!Margin.Value > 50.0,50.0,Fields!Margin.Value),
0
 

Author Comment

by:gotti777
ID: 34915347
this is the raw data without the P  

 a
I amasuming 50 is wrong
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

Author Comment

by:gotti777
ID: 34915357
should i be using .50  instead of 50
0
 
LVL 9

Expert Comment

by:sureshbabukrish
ID: 34915408
yes , exactly
0
 
LVL 9

Expert Comment

by:sureshbabukrish
ID: 34915433
did it work?
0
 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 34916736
That was I told before. 0.5 for 50%
0
 

Author Comment

by:gotti777
ID: 34917732
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
0
 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 34917920
Check in the color properties of the field.
0
 

Author Comment

by:gotti777
ID: 34917963
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))

?
0
 
LVL 52

Accepted Solution

by:
Vitor Montalvão earned 1000 total points
ID: 34917989
Should be between quotes. Like "Red", "Blue", ...
0
 

Author Closing Comment

by:gotti777
ID: 34920026
worked great thank you
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question