SSRS Prior Month, MTD Same period as current month

徘徊边缘 提交于 2019-12-13 06:57:00

问题


Should be easy right?

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), )

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)

回答1:


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), )



来源:https://stackoverflow.com/questions/25249713/ssrs-prior-month-mtd-same-period-as-current-month

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!