Date Header
Can anyone help me find a solution to a SSRS Date problem I'm having. I need to Display the in this format: " Ranking ScoreBoard Month/YYYY" , but if its the First day of the month the header will still need to display the previous Month/Year.
Can anyone please help me with this?
Thanks,
Darrell
May 21st, 2012 10:38am
SELECT
CASE WHEN DATEPART(DAY, GETDATE()) = 1 THEN DATENAME(month, DATEADD(month, -1, GETDATE())) + '/' + DATENAME(YEAR, GETDATE())
ELSE DATENAME(month, GETDATE()) + '/' + DATENAME(YEAR, GETDATE())
END AS ReportDate
Should do the job ...
Free Windows Admin Tool Kit Click here and download it now
May 21st, 2012 11:50am
Hi Darrell,
You can achieve your goal by using an expression as follows:
=IIF(DatePart(DateInterval.Day, Fields!DateVal.Value)=1,DatePart(DateInterval.Month,DateAdd(DateInterval.Day,-1,Fields!DateVal.Value))&"/"& DatePart(DateInterval.Year,(DateAdd(DateInterval.Day,-1,Fields!DateVal.Value))),Format(Fields!DateVal.Value,"M/yyyy"))
The screenshot below for your reference:
Reference:
Expression Examples
If you have any questions, please feel free to let me know.
Regards,
Mike Yin
May 24th, 2012 7:05am