ssrs expression to calculate number of worked days in particular month - reporting-services

i need to calculate the number of worked days in a particular month. i have start date and end date depending on this i have to calculate the worked days in particular month. in ssrs report please help me with a ssrs expression to solve the problem.
i have a logic to do this but how to do it in a SSRS expression is a problem.
the logic is:
if(start date is in January than
start date-31/1/2014)
//this will give me the worked days in January
if(start date is not in January
start date-1/1/2014 //this gives me working days till January
(total working days)-( start date-1/1/2014)//this gives me working days after January 1
if((total working days)-( start date-1/1/2014)>31
then my answer is 31 days worked in January.
i have to convert this logic in to ssrs expression, is it possible?
is there any alternate way to do this ?
please help me with this.

Related

SSRS Expression for getting current week Sunday-Saturday

I am looking to make a report that gets the current week from sunday to saturday, i was thinking oh the headers of it having the date of the current week of running the report, does anyone know how to do that?
I assuming what you are asking is how to filter your dataset to show only records within the same week as the current week?
if so then you can do something like this
=WEEK(today()) = WEEK(Fields!myDateField.Value)
This will return True if the week is in the same week as the current week.
For more info on the WEEK function see here
https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2008/aa337345(v=sql.100)

Current and Previous Month Revenue in Report

In Access 2013, I have a report showing revenue for each month of the year. I was success in getting a formula to name the previous month:
=Format$(DateAdd("m",-1,([ApptDate])),"mmmm",0,0)
What I am trying to get, is the revenue for the previous month for comparison, like a distribution chart. This is as close as I have gotten to something working, but the sum of the revenue for the previous month is too low (maybe only for a day's revenue?) Could anyone please help me put the following formula in the right order with right parameters to get the date needed?
=Sum(DateAdd("m",-1,([revenue])))
If I understood your problem correctly, you could use the DSum function by setting as criteria the month of the date to the previous month.
=DSum("[revenue]","YourTableName","Month([ApptDate])=" & Month(DateAdd("m",-1,Date())))

SSRS Date Parameter default to last 30 days with Time

Please could someone help me in getting the below issue sorted?
I am looking for a default Date Parameter (Start Date) to be Last 30 days from Today along with the Time e.g 30 days from now is 24/05/2016 but would like to include Time as well
24/05/2016 07:00:00
I have an expression which only give me Last 30 days date Expression i have is =DateAdd("d",-29,Today())
Regards
Try:
=Now.AddDays(-30)
UPDATE: Default time
=Today.AddDays(-30).AddHours(7)
Let me know if this helps.
SSRS Expression to get 30 days back from today using DateAdd function:
=DateAdd(DateInterval.Day, -30,Today())

SSRS - Report Builder 3.0 - This Day Last Year

I'm trying to get a Today vs This Day Last Year Comparison Report sorted.
I set a 'From' and 'To' date based on a 'Preset' parameter.
So if it is set to 'This Week' it sets the start date to Monday and the end date to Sunday.
What I want now is a Today vs This Day Last Year. So for example, if i were to do it for today, I would get 09/04/2015 vs 10/04/2014. So as today is Thursday, I want the nearest Thursday from 09/04/2014.
Also want the same for 'Yesterday'. So 08/04/2015 vs 09/04/2014
Is there a way to do this in either the Parameters SSRS expression, or within the custom 'Code' section?
To get this day last year, you can just subtract 52 weeks from today. Try this expression: =DateAdd("ww",-52,Today()). Likewise you can subtract 1 day from today to get yesterday: =DateAdd("d",-1,Today()).

How to get current month name in SSRS?

I need current month name as default perameter name in my ssrs report. How can I get current month name using an ssrs expression?
For example "27-09-2012" would become "September"
and one more i need....
27-09-2012 to previous month name as well (August)
First question:
=MonthName(Month(Fields!datefield.Value))
Second question:
=MonthName(Month(DateAdd("m", -1, Today())))
I think the second question answer might be something like that, first converting the date to month then subtracting 1 from the month value and then converting it to month name.
Further reading:
SSRS Reports get Month name from Month Index or from date
Converting month number to month name in reporting services
OFF: I would change the date format you are using to 2012-09-27 as it works in every setting and should give you peace of mind when converting date formats.
Don't subtract 1 b/c it won't work for January.
Use this:
MonthName(Month(DateAdd("m", -1, CDate(Today))))
As a note, I tried the suggestion of =MonthName(Month(today())). What I would get is #error for whatever field the expression was in. However, =MonthName(str(Month(today()))) worked for me. I am unsure of whether or not the MonthName method changed to require a string or if it is some issue with my program. Just figured I would post this in case anyone else was having the same issue.
For Previous Month i found universal way : =MonthName(Month(CDate(Today()))-1,False) for SEPTEMBER (Full Month Name) 'OR'
=MonthName(Month(CDate(Today()))-1,True) for SEP (Short Month Name)