Link to home
Start Free TrialLog in
Avatar of mdiglio
mdiglioFlag for United States of America

asked on

Help with iif statement in a report

Hello,
If more info is needed just ask...I didn't want to clutter this up w/ too much detail on what the fields are and what I am trying to do.

I'm using Reporting Services. For the y axis on a chart report I have the following:

=round(Fields!CountOfLoginTime.Value/ Sum(Fields!no_of_weeks.Value, "average")/5,0)

This works and returns the expected result.
However for one instance ( a parameter )  I would like to divide by 6 instead of 5.
So I was thinkng I needed an iif statement

I have one parameter in the report... Parameters!location.Value

So how can i write the following iif statement ? or any other method that can be used

if Parameters!location.Value = 'ab123' then
round(Fields!CountOfLoginTime.Value/ Sum(Fields!no_of_weeks.Value, "average")/6,0)
else
round(Fields!CountOfLoginTime.Value/ Sum(Fields!no_of_weeks.Value, "average")/5,0)

Thank you for your time
Avatar of mdiglio
mdiglio
Flag of United States of America image

ASKER

Oops...i'm sorry
Can there be an OR in there ?

if Parameters!location.Value = 'ab123'  or 'ab321' then
round(Fields!CountOfLoginTime.Value/ Sum(Fields!no_of_weeks.Value, "average")/6,0)
else
round(Fields!CountOfLoginTime.Value/ Sum(Fields!no_of_weeks.Value, "average")/5,0)
Avatar of Renante Entera
Hi mdiglio!

You will simply do it like this :

if (Parameters!location.Value = 'ab123'  or Parameters!location.Value = 'ab321') then
  round(Fields!CountOfLoginTime.Value/ Sum(Fields!no_of_weeks.Value, "average")/6,0)
else
  round(Fields!CountOfLoginTime.Value/ Sum(Fields!no_of_weeks.Value, "average")/5,0)

Hope this helps you.  Just try it.


Goodluck!
eNTRANCE2002 :-)
Avatar of mdiglio

ASKER

Hi,
Thanks for the response.
That doesn't seem to work as an expression
ASKER CERTIFIED SOLUTION
Avatar of andrewbleakley
andrewbleakley
Flag of Australia image

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 mdiglio

ASKER

Hey...I like it!
Thanks for the help