reporting services - Trying to display weekday calendar dates with business days on my SSRS report -
i have report in have business days (so no weekends) calculated based on calendar date in event occurred in sql query. ie,
date_completed: 22 jan 2014 (<--- system tables)
day_completed = 16 <---- calculated in query.
now, trying create calendar-like report in ssrs purpose of tracking event dates. want make business days , corresponding calendar date column headers ie
1
1/1/2014
2
1/2/2014
so problem events not occur on every business day, created bunch of dummy values in query (basically union 1-40 business days...i'll work on making dynamic in future).
so have 1-40 business day columns, , values aligning them properly...however, calendar dates not matching because not know how make ssrs skip weekend dates in column header...
i tried like:
=iif((weekday(dateadd("d",fields!period_complete.value,fields!period_dt.value))<>1 or weekday(dateadd("d",fields!period_complete.value,fields!period_dt.value))<>7), dateadd("d",fields!period_complete.value,fields!period_dt.value),"")
but did nothing. have ideas on how can ssrs spit out non-weekend, calendar dates quarter (jan-mar)?
i see question you're trying use ssrs expressions achieve desired result. however, when comes dynamic filtering, i've found myself turning sql majority of work. in mind, think achieve desired goal.
the query below create list of dates year (equal current year based on system time). then, give day of week integer , day of year. additionally, filter out saturdays , sundays, leaving working days. finally, calculates quarter we're in (i'm using quarters calendar year, adapt rolling quarters or fiscal year quarters) way of filtering list of days current quarter. please let me know if have questions.
declare @start date = case when month(getdate()) <= 3 '01/01/' + cast(year(getdate()) varchar(4)) when month(getdate()) <= 6 '04/01/' + cast(year(getdate()) varchar(4)) when month(getdate()) <= 9 '07/01/' + cast(year(getdate()) varchar(4)) else '10/01/' + cast(year(getdate()) varchar(4)) end; declare @end date = case when month(getdate()) <= 3 '03/31/' + cast(year(getdate()) varchar(4)) when month(getdate()) <= 6 '6/30/' + cast(year(getdate()) varchar(4)) when month(getdate()) <= 9 '09/30/' + cast(year(getdate()) varchar(4)) else '12/31/' + cast(year(getdate()) varchar(4)) end; set nocount on; all_dates ( select cast('01/01/' + cast(year(getdate()) varchar(4)) date) dates union select dateadd(day,1,dates) dates all_dates dates < '12/31/' + cast(year(getdate()) varchar(4)) ) select datepart(dayofyear,dates) day_of_year , datepart(weekday,dates) day_of_week , dates all_dates datepart(weekday,dates) between 2 , 6 , dates >= @start , dates <= @end option (maxrecursion 400);
Comments
Post a Comment