Solved

If statement in SSRS

Posted on 2011-02-16
12
898 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
12 Comments
 
LVL 50

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 250 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

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 50

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 50

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 50

Accepted Solution

by:
Vitor Montalvão earned 250 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

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

728 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