【问题标题】:SSRS Prior Month, MTD Same period as current monthSSRS 上月,MTD 与当月相同的期间
【发布时间】:2014-08-12 04:07:22
【问题描述】:

应该很容易吧?

今天是 2014 年 8 月 11 日。我想要一个能反映我拥有的 MTD 的专栏:

=Count(IIf(Year(Fields!Date.Value) = Year(Today) And Month(Fields!Date.Value) 
= Month(Today), Fields!ID.Value, Nothing), )

但我还想要 SSRS 中的一列,显示上个月 2014 年 7 月 11 日的相同时间范围。

我可以得到出现的日期,但我一辈子都无法弄清楚如何像当月那样获取数据

=FormatDateTime(DateSerial(DatePart("yyyy",today()), DatePart("m",today())-1, 
 DatePart("d",today())), DateFormat.ShortDate)

【问题讨论】:

  • 不是 100% 确定问题是什么。您是指用您的字段替换“today()”函数吗? =FormatDateTime(DateSerial(DatePart("yyyy",Fields!Date.Value), DatePart("m",Fields!Date.Value)-1, DatePart("d",Fields!Date.Value)), DateFormat.ShortDate)
  • 您是说要比较当前 MTD 总数与同一时间范围内的先前 MTD 总数。又名“上个月这个时候我过得怎么样?”
  • @lethaljd,是的。我想看看这个月与上个月同期相比我的表现如何。

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


【解决方案1】:

第二列公式看起来像 =Count(IIf(Year(Fields!Date.Value) = Year(Today().AddMonths(-1)) 和 Month(Fields!Date.Value) = Month(Today().AddMonths(-1)) AND DatePart("d", Fields!Date.Value)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-27
    • 2014-01-25
    • 1970-01-01
    相关资源
    最近更新 更多