0
votes

I've been scouring the forums but to no avail and I need help with displaying a certain value with an expression. I have a table with this Dataset set:

Description | Value

     Var1  | 10

     Var2  | 20

     Var3  | 30

     Var4  | 40

I've been trying to make an Expression thru SSRS in a way where =IIF(Fields!Description.Value, "Var1") THEN (Display 10 here)

I can't figure out a way to display the corresponding value of the row associated with that dataset.

Hope I can get some help.

Regards,

MPatrick

1

1 Answers

3
votes

In SSRS the proper way to use the IIF function is this:

=IIF(Fields!Description.Value = "Var1", "10", "")

If the first parameter into the function evaluates as true, the second parameter is returned, otherwise the third parameter is returned.

If you are really trying to display a value from another dataset, you need a lookup.

=Lookup(Fields!Description.Value, Fields!Description.Value, Fields!Value.Value, "Dataset2")

What this is doing is trying to match the Description value in the current dataset to the same value in a second dataset named Dataset2, and returning the value in a field from Dataset2 named Value. This may seem confusing, but your sample named the fields Description and Value, so I tried to keep with that.

This will work in a lookup, too.

=Lookup("Var1", Fields!Description.Value, Fields!Value.Value, "Dataset2")

In plain English: Give me the Fields!Value.Value in Dataset2 where the Fields!Description.Value is equal to Var1.