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

x
?
Solved

Case statement in SSRS

Posted on 2011-02-11
14
Medium Priority
?
956 Views
Last Modified: 2012-05-11
I have a margin % field.  I need an 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 stament that if it is changed make it red..  

 a
0
Comment
Question by:gotti777
  • 7
  • 3
  • 3
  • +1
14 Comments
 
LVL 1

Accepted Solution

by:
johnnyaction earned 2000 total points
ID: 34874659
This should work...

=IIF(Fields!Margin.Value > 50,50,IIF(Fields!Margin.Value < 0,0,Fields!Margin.Value))
0
 

Author Comment

by:gotti777
ID: 34874937
Hmmm i tryed it  abut it shows the same
 b
0
 
LVL 1

Expert Comment

by:johnnyaction
ID: 34876237
what is the data type for margin?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 34876662
This is a duplicate question see here:
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_26815224.html#a34876656
One of the two questions needs to be deleted or the points reduced in both.
0
 
LVL 25

Expert Comment

by:TempDBA
ID: 34878443
This looks like a problem of datatype. How you are adding %? is it directly from the sql server or you changed the format from SSRS?
0
 

Author Comment

by:gotti777
ID: 34888072
I created a Data Set in Layout...   So it not cooming from SSRS

I made an expression to get %
 a
0
 

Author Comment

by:gotti777
ID: 34889159
I mean its not comming from the Server .. I have a Expression thats calculated From 2 other data sets
0
 
LVL 25

Expert Comment

by:TempDBA
ID: 34894389
And to add the %, you might have change the format of the textbox\column. Right?
0
 

Author Comment

by:gotti777
ID: 34897077
Yes I changed it to P
0
 
LVL 25

Expert Comment

by:TempDBA
ID: 34904577
Change the format style back to decimal or int and try once. I am sure this has something to do with the percentage formatting. For time being multiply the values with 100.
0
 

Author Comment

by:gotti777
ID: 34911712
ok weird .. I tryed formatting to D or n and still nothing  then i tryed to add

=(Fields!Gross_Sales.Value-Fields!OrderCost.Value)/Fields!Gross_Sales.Value

i changed the data margin set to

=((Fields!Gross_Sales.Value-Fields!OrderCost.Value)/Fields!Gross_Sales.Value)*100

and it worked..Some what  percent are high
 a
0
 

Author Comment

by:gotti777
ID: 34911738
this is the raw data .. is it because the data it .xxx   and the if statment uses   50?
ScreenHunter-14-Feb.-16-17.28.gif
0
 

Author Closing Comment

by:gotti777
ID: 34920041
Just needed to change 50 to .50  for it to work thank you
0
 
LVL 1

Expert Comment

by:johnnyaction
ID: 34921100
your very welcome
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

926 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