SSRS - Report Builder 3.0 - This Day Last Year - reporting-services

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()).

Related

SSRS report #To parameters

I need last Sunday date with whole day time count. By using this
DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)
I am getting time As 12AM, but I need all day time.

SSRS expression to get same month through today but for last year?

For example I would like the expected output to be 8/21/2018.
I have an expression to get the month of August of 2018 below, but not sure how to modify to get through the same date instead of returning the full month.
=DateAdd(DateInterval.Month, -12, DateAdd(DateInterval.Day,-Day(Today())+1,Today()))
If I get this correctly you want one year ago from a given date with todays day?
'Today: 8/23/2019
'Input: 8/21/2019
'Output: 8/23/2018
That would be this expression:
=DateSerial(Year(DateAdd("yyyy", -1, CDate("8/21/2019"))),
Month(CDate("8/21/2019")),
Day(Today()))

SSRS Report Parameters Start date to be set for Friday when Current day is Monday

I have a report parameters start date and end date both set for previous day. I have report subscription that runs on each day of the week. But, when it executes on Monday, I need to change the Default parameter to run from the Prior Friday's date thru Sunday. How can I achieve this? TIA
I just replicated your use case locally.
For your start date parameter you will need expression as below. It will check if today is Friday (Weekday starts from Sunday) then set start date as Friday from last week else previous day. This shall work.
=IIF(WeekDay(today)=2,DateAdd("d",-3,today),DateAdd("d",-1,today))

Week To Date Based Off Current Date

I am looking for an expression that will allow to me find the date of Monday of the week of my Date Field, to be used in a filter for a tablix.
Example, my date field today is 22/01/2019. I would like an expression that will return 21/01/2019. If the date was 26/01/2019, it should still return 21/01/2019.
For next week 31/01/2019 would return 28/01/2019.
Week starting Monday going to Sunday.
If its also possible for a similiar expression but to find the beginning of the month as well?
Is that possible?
Many thanks
To get the date of last Monday that occurred you can use something like
=Today.AddDays(1-WeekDay(Today(),FirstDayOfWeek.Monday))
and for the first of the month its just
=DateSerial(Year(Today()), Month(Today()), 1)
Both the above are based on the today() function, if you need them based on a date parameter, then the expression is a little different but your question stated "today".
monday of the week use the following expression:
DateAdd("d",DatePart(DateInterval.WeekDay,Fields!myDatefield.Value,0,0)+1,Fields!myDatefield.Value)
first day of the month use the following expression:
=DateAdd("d",-(Day(Fields!myDatefield.Value)-1), Fields!myDatefield.Value)

ssrs expression to calculate number of worked days in particular month

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.