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
Solved

If statement in SSRS

Posted on 2011-02-16
12
884 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 48

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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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 48

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 48

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 48

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.net Duplicating a table - primary key not created 3 31
Database Integrity 1 48
SQL Recursion 6 16
.NET Enums [Flags] & Bitwise Design Question 6 19
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

809 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