Link to home
Start Free TrialLog in
Avatar of Gabe Lebron
Gabe LebronFlag for United States of America

asked on

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..  

 User generated image
ASKER CERTIFIED SOLUTION
Avatar of johnnyaction
johnnyaction

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gabe Lebron

ASKER

Hmmm i tryed it  User generated imagebut it shows the same
 User generated image
Avatar of johnnyaction
johnnyaction

what is the data type for margin?
Avatar of Anthony Perkins
This is a duplicate question see here:
https://www.experts-exchange.com/questions/26815224/If-Statement-for-recalculating-Values.html?anchorAnswerId=34876656#a34876656
One of the two questions needs to be deleted or the points reduced in both.
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?
I created a Data Set in Layout...   So it not cooming from SSRS

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