SSRS date to and From parameters default to current financial year - reporting-services

I have a Dynamics CRM SSRS report which has two date parameters to filter records when report is executed.
When running the report I would like the parameters to default to the current financial year eg. if today is 01/10/2017 then From should default to 01/04/2016 and To should default to 31/03/2017.
Can this be done and if so what is the best way?

Not sure why people are over complicating this. I understand the common need for date tables, I use them a lot but it's pretty easy to do in an expression.
The From date expression needs to be
=DATESERIAL(Year(Now()) - (IIF(format(now(),"MMdd") > "0331",0,1)) ,4,1)
and the to date expression needs to be
=DATESERIAL(Year(Now()) + (IIF(format(now(),"MMdd") > "0331",1,0)) ,3,31)
All we are doing is creating a date value that is either 1st April current year or 31st March current year then depending on if the current date is on or before the 31st March we adjust the year by 1.
I'M ASSUMING YOUR DATES ARE WRONG IN YOUR EXAMPLE. You said you wanted current financial year but your sample showed last financial year. Anyway, if the code above is incorrect just adjust the Year(Now()) to be (Year(Now())-1) .

Related

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

How to get specific date based upon current year in ssrs

Can someone tell me how to get specific date based upon current year in SSRS report parameters.
ex: if current year is 2016 I want date field to populate as 31-Dec-2014,
if current year is 2017 then it should be 31-Dec-2015,
if current year is 2018 then it should be 31-Dec-2016, etc.
Try:
=DateSerial(Today.Year-2,12,31)
Let me know if this helps.

SSRS Dynamic Date Parameters

I'm fairly new to reporting and need help with the following?
I have a report that has two date parameters statically set to default to the last financial year. i.e. the FROM parameter 01/04/2015 and the TO parameter 31/03/2016.
When the actual date next year is 01/04/2017 I need these parameters to change forward by one year, I know I maybe able to do it with a case statement and a getdate + dateadd .
I have a small table which creates a year period based on certain dates which I then join onto the data then I use that to filter.
for instance:
1516
1617
1718
so if #year_period = 1516 then the previous year would simply be #year_period-101 and the future would be #year_period+101

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.

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)