1

I am trying to create an expression with an IIF statement:

1st condition that takes a parameter minus 1 = field1 2nd condition takes another parameter = 'field2

true false

I have tried to use switch, sum etc. It has been 8 years since I have created an srs report, so I am a little rusty.

The following is my most recent expression.

=IIF(Parameters!FiscYr.Value -1 = Fields!FiscYr.Value, IIF(Parameters!Period.Value = 01, Fields!YtdBal00.Value,0))

Thank you in advance for your assistance.

2
  • What language are you using? Commented Sep 19 at 19:48
  • 1
    IIF takes and expression and a true and false. IIF (expr,true,false). It looks like you missing the false part of the argument. Commented Sep 19 at 21:15

1 Answer 1

0

Since you have not mentioned any language, it is tough to identify the syntax as there would be so many. However, if it is just visual basic, then you can modify your code slightly to a better structure:

=IIF(Parameters!FiscYr.Value - 1 = Fields!FiscYr.Value AND Parameters!Period.Value = "01", Fields!YtdBal00.Value, 0)

COnsidering the fact that you want to have:

  • Check if Parameters!FiscYr.Value - 1 = Fields!FiscYr.Value

  • Then, within that, check if Parameters!Period.Value = 01

  • If both are true, return Fields!YtdBal00.Value, otherwise return 0

In case your Period.Value is numeric, which should be the ideal scenario, then

=IIF(Parameters!FiscYr.Value - 1 = Fields!FiscYr.Value AND Parameters!Period.Value = 1, Fields!YtdBal00.Value, 0)

Since the OP has posted the comment for rdl, then with respect to RDL, you can do

=IIF(
    Parameters!FiscYr.Value - 1 = Fields!FiscYr.Value AND 
    Parameters!Period.Value = 1, 
    Fields!YtdBal00.Value, 
    0
)
Sign up to request clarification or add additional context in comments.

2 Comments

I am using Visual Basic. I had tried the suggestion above before and it returns '0'. I retried and got '0' again.
I have updated my answer for rdl considering rdl is Report Definition Language which you later want to use this expression in SSRS or something similar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.