问题
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