Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need week number of year in SSRS 2008

hoping someone can help -- Googling provided none. I need to get the week number (of the year) from a date. I've added field "week_num" to my dataset and when I went to create the expression, I see there is no "WEEK" function under Date/Time?

In VB and other languages there is a simple week function but I don't see it in SSRS 2008. For example, if the date is '2014-03-16', I want the week number, which is 12.

can anyone help?

like image 758
Kim Jones Avatar asked Dec 11 '22 09:12

Kim Jones


1 Answers

regarding this question, i had the same issue, (kinda sucks that SSRS does not share same function references and params that MSSQL being part of it ) but here's the instruction set for datepart, in this case directly for SSRS>

for this date as example>

=DatePart(DateInterval.Month, today())

this will output current date's month number.

here's a list for some valid dateinterval parameters, in SSRS datepart function

  • DateInterval.Second
  • DateInterval.Minute
  • DateInterval.Hour
  • DateInterval.Weekday
  • DateInterval.Day
  • DateInterval.DayOfYear
  • DateInterval.WeekOfYear
  • DateInterval.Month
  • DateInterval.Quarter
  • DateInterval.Year
like image 179
Pablo Contreras Avatar answered Dec 30 '22 04:12

Pablo Contreras