SSRS如果列X值=" X"然后显示相应的列Y值

时间:2015-06-26 13:00:36

标签: reporting-services

我正在使用SSRS 2008并且有一个如下所示的数据集:(简化)

RESULTGUID    Question    ANSWER 
1234          How Old     15
1234          How New     13
1234          How Big     700
1234          How Small   100
etc etc

我正在寻找像以下一样的IIF声明:

=iif(fields!Question.value = "How Old",Fields!Answer.value,"N/A")

但是,这与第一行不同,所以如果第一行(字段等等则可以正常工作,但不适用于数据集下方的行。

有人可以提供解决方案吗?

1 个答案:

答案 0 :(得分:0)

如果你在SSRS中完成所有操作,它可能是一个大的嵌套Iif语句:

=Iif(fields!Question.value = "How Old",Fields!Answer.value,Iif(fields!Question.value = "How New",Fields!Answer.value,
Iif(fields!Question.value = "How Big",Fields!Answer.value,Iif(fields!Question.value = "How Small",Fields!Answer.value,"N/A"))))

或者你可以做一个SWITCH声明:

=SWITCH(
    fields!Question.value = "How Old", Fields!Answer.value
    fields!Question.value = "How New", Fields!Answer.value
    fields!Question.value = "How Big", Fields!Answer.value
    fields!Question.value = "How Small", Fields!Answer.value
    )