本文介绍了SSRS 上月,MTD 与本月同期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应该很容易吧?

今天是 2014 年 8 月 11 日.我想要一个反映我拥有的 MTD 的列:

Today is Aug 11, 2014. I want a column that reflects MTD Which I have:

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

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

BUt I also want a column in SSRS that shows me the same time frame for the previous month, 7/11/2014.

我可以让日期出现,但我一生都无法弄清楚如何像当月一样获取数据

I can get the date to appear, but I can't for the life of me figure out how to grab the data like I have for the current month

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

推荐答案

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

the second column formula would look something like =Count(IIf(Year(Fields!Date.Value) = Year(Today().AddMonths(-1)) And Month(Fields!Date.Value)= Month(Today().AddMonths(-1)) AND DatePart("d", Fields!Date.Value) <= DatePart("d", Today()), Fields!ID.Value, Nothing), )

这篇关于SSRS 上月,MTD 与本月同期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 20:30