Solved

If statement in SSRS

Posted on 2011-02-16
12
892 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 49

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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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 49

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 49

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 49

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

749 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