user2943682
user2943682

Reputation: 1

Query in SSRS for IF condition with 2 results

I am trying to fetch message A when the currency chosen is AUD or CAD and message B if any other currency is chosen, below is what I am trying but not working. Below always display MessageB if I enter AUD, please help:

=IIf(First(Fields!FromCurrencyCode.Value ,"CageDBDataset_spRptVoucherCurrencyExchange") ="AUD", "messageA", IIf(First(Fields!FromCurrencyCode.Value ,"CageDBDataset_spRptVoucherCurrencyExchange") = "CAD" ,"messageA","messageB"))

Upvotes: 0

Views: 122

Answers (1)

Chris Latta
Chris Latta

Reputation: 20560

You are looking up the value of the first row of the dataset rather than the current row. So if the first row isn't AUD or CAD then you will always get messageB for every row.

Assuming the tablix's dataset is CageDBDataset_spRptVoucherCurrencyExchange then the expression you want to use is:

=IIf(Fields!FromCurrencyCode.Value = "AUD" OR Fields!FromCurrencyCode.Value  = "CAD", "messageA", "messageB")

Upvotes: 2

Related Questions