【问题标题】:Multiple conditions in an IIF StatementIIF 语句中的多个条件
【发布时间】:2015-07-09 03:12:47
【问题描述】:

我有一个包含以下字段和数据的表格:

Offense, Year, Month, Count, Amount

 F 2007 January 11 $49,238.00
 F 2007 February 12 $24,000.00
 F 2007 March 31 $55,184.00
 F 2007 April 19 $64,647.00
 F 2007 May 33 $100,010.00
 F 2007 June 16 $59,678.00
 F 2007 July 22 $39,700.00
 F 2007 August 3 $9,000.00
 F 2007 September 4 $75,000.00
 F 2007 October 8 $19,250.00
 F 2007 November 50 $106,153.00
 F 2007 December 26 $80,000.00

我有 2007-2014 年的数据并设计 SSRS 报告,并希望使用 IIF 语句返回数据。使用以下内容:

=IIF(Fields!Year.Value="2007" AND Fields!Month.Value="February", Fields!Count.Value, "n/a")

上面不行,它不返回Count字段的值,它确实返回n/a

我正在寻找以下结果。

If Year = 2007 and Month = February, Count will = 12

有人可以帮忙吗?

【问题讨论】:

    标签: reporting-services iif


    【解决方案1】:

    试试

    =IIF(Fields!Year.Value=2007 AND Fields!Month.Value="February", CSTR(Fields!Count.Value), "n/a")
    

    【讨论】:

    • cqi:我没有得到计数结果,它传递给“n/a”。
    • 我可以建议分解表达式以检查一切是否正常,例如 =IIF(Fields!Year.Value="2007" , "Expression correct", "Expression not correct") =IIF(Fields! Month.Value="February" , "Expression correct", "Expression not correct") 这样您就可以确认数据类型是否正确。然后尝试组合表达式以使用如上所示的“AND”关键字
    猜你喜欢
    • 2019-02-08
    • 1970-01-01
    • 2021-12-19
    • 1970-01-01
    • 1970-01-01
    • 2021-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多