• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 972
  • Last Modified:

Case statement in SSRS

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
gotti777
Asked:
gotti777
  • 7
  • 3
  • 3
  • +1
1 Solution
 
johnnyactionCommented:
This should work...

=IIF(Fields!Margin.Value > 50,50,IIF(Fields!Margin.Value < 0,0,Fields!Margin.Value))
0
 
gotti777Author Commented:
Hmmm i tryed it  abut it shows the same
 b
0
 
johnnyactionCommented:
what is the data type for margin?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Anthony PerkinsCommented:
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
 
TempDBACommented:
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
 
gotti777Author Commented:
I created a Data Set in Layout...   So it not cooming from SSRS

I made an expression to get %
 a
0
 
gotti777Author Commented:
I mean its not comming from the Server .. I have a Expression thats calculated From 2 other data sets
0
 
TempDBACommented:
And to add the %, you might have change the format of the textbox\column. Right?
0
 
gotti777Author Commented:
Yes I changed it to P
0
 
TempDBACommented:
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
 
gotti777Author Commented:
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
 
gotti777Author Commented:
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
 
gotti777Author Commented:
Just needed to change 50 to .50  for it to work thank you
0
 
johnnyactionCommented:
your very welcome
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 7
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now