I have a start date and an end date in my report. Now when the report is run, we want to display if it's current year and if so, display "2016" else, using the end date as a guide, display the year judging by the end date. How do I accomplish this in SSRS?
1 Answers
1
votes
If the End Date is a parameter you could just have an expression like this:
=DatePart("yyyy",Parameters!EndDate.Value)
or if your end date is a field in the data set you could do this:
=DatePart("yyyy",Max(Fields!EndDate.Value, "DataSet1"))
if you want to conditionally check the max end date value to compare against the current year you could do the following, however not needed if you are always showing the max end date's year:
=IIF( DatePart("yyyy",Max(Fields!EndDate.Value, "DataSet1")) = DatePart("yyyy",DateTime.Now),DatePart("yyyy",DateTime.Now), DatePart("yyyy",Max(Fields!EndDate.Value, "DataSet1")) )