SSRS:添加折线图

时间:2016-02-10 07:48:16

标签: sql reporting-services

我在这里创建了这个图表: enter image description here

我在图表中添加了一个新系列,其值为75(绿线)。

我想分步显示绿线。我在这里尝试了这个表达式:

=iif(Fields!Datum.Value = "2015-08-09 00:00:00",75,0, iif(Fields!Datum.Value = "2015-09-13 00:00:00",77,0, iif(Fields!Datum.Value = "2015-10-11 00:00:00",79,0, iif(Fields!Datum.Value = "2015-11-08 00:00:00",81,0, iif(Fields!Datum.Value = "2015-12-13 00:00:00",83,0 ) ) ) ))

但是这显示了一个错误

  

公共功能IIf的参数太多(表达式为布尔值,   TruePart As Object,FalsePart As Object)As Object'

@AKM:我编辑了我的表达,现在我的图表看起来像这样:

enter image description here

1 个答案:

答案 0 :(得分:1)

你得到的错误是因为错误中所说的参数太多了。

iif的工作方式如下:

  

IIF( CND DWT DWF

  • CND =条件,在您的情况下:字段!Datum.Value =“...”
  • DWT =显示为真,在您的情况下:75,77 ......
  • DWF =显示当为False时,它就像else语句一样,在你的情况下:0

现在看看你的iif:

=iif(Fields!Datum.Value = "2015-08-09 00:00:00",75,0, iif(Fields!Datum.Value = "2015-09-13 00:00:00",77,0, iif(Fields!Datum.Value = "2015-10-11 00:00:00",79,0, iif(Fields!Datum.Value = "2015-11-08 00:00:00",81,0, iif(Fields!Datum.Value = "2015-12-13 00:00:00",83,0 ) ) ) ))

你的iif构造有4个参数,这是不正确的:

  

IIF( CND DWT DWF ,IIF(...) )< / strong>

你必须用你的下一个IIF替换DWF才能看起来像

  

IIF( CND DWT IIF(...)

您所寻找的必须是:

=IIF(Fields!Datum.Value = "2015-08-09 00:00:00", 75, IIF(Fields!Datum.Value = "2015-09-13 00:00:00", 77, IIF(Fields!Datum.Value = "2015-10-11 00:00:00", 79, IIF(Fields!Datum.Value = "2015-11-08 00:00:00", 81, IIF(Fields!Datum.Value = "2015-12-13 00:00:00", 83, 0)))))