【问题标题】:SSRS expression Year and Month only from Date field仅来自日期字段的 SSRS 表达式年和月
【发布时间】:2014-07-29 21:33:28
【问题描述】:

如何在 SSRS 中构建仅捕获月份和年份而不是日期戳字段中的日期的表达式?

我正在尝试在 SSRS 中创建一个本月至今列。我有一个日期时间戳字段,我还创建了一个月份字段和一个年份字段,以期解决我自己的问题。我没有。

我构建了一个表达式,允许我捕获月份并且它有效,但在我的数据集中,我有 2013 年和 2014 年的 7 月数据。这个表达式我只想捕获 2014 年。

=Count(IIF(Fields!Date_Month.Value = Month(Today()), Fields!AcctNo.Value, Nothing), 
"Eligibility")

我让它为这一年工作:

=Count(IIF(Fields!Year.Value = Year(Today()), Fields!AcctNo.Value, Nothing), 
"Eligibility")

我可以以某种方式组合这 2 个表达式吗?我应该吗?

哦,呸呸呸

我已尝试使用我的日期戳字段来禁止使用 avial:我收到 #Error with this abomination

=Count(IIF(Fields!Datestamp.Value = Month(Today()), Fields!AcctNo.Value, 
Nothing),   "Eligibility")

我认为首选方法是使用我上面的日期戳字段并解析出月份和年份。这就是我会这样做的方式......如果我知道如何真正做到这一点。

【问题讨论】:

    标签: reporting-services ssrs-2008 ssrs-grouping


    【解决方案1】:

    正如您所建议的,您可以将两个表达式结合起来,只需进行一些小的更改即可获得所需的结果:

    =Count(IIf(Year(Fields!Datestamp.Value) = Year(Today)
          and Month(Fields!Datestamp.Value) = Month(Today)
        , Fields!AcctNo.Value
        , Nothing)
      , "Eligibility")
    

    这将计算数据集中与当前日期具有相同年份和月份的所有行。

    【讨论】:

    • 不知怎的,我知道你会救我。好样的先生。正是我需要的
    猜你喜欢
    • 2019-09-27
    • 2015-01-12
    • 2015-12-25
    • 1970-01-01
    • 2014-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多