Graph - just show last 12 months - reporting-services

I have a line graph in my report.
My report has no parameters on it.
What I ideally want it to do is if I run the report today (May) it will only show me the last 12 months so May to May.
At the moment it is including April from last year as well, so would want that excluded. If I run it in two months time in July I would want it to only show July to July.
Hi,
The key here is the DatePaid field. This is the date that drives the graph.
The graph gets the Financial Year and Month from a date table.
The plots on the graph use an expression -
[code="other"]=SUM(IIF(Fields!InvoicePaid_.Value = "Yes" And Fields!PaidTarget.Value = "InTarget",1, 0))/Count(IIF(Fields!InvoicePaid_.Value = "Yes", 1, Nothing))[/code]
This allows a % to be calculated on the graph series you see above, to just show invoices that have been paid and are in target.
The report uses TSQL and I'm wondering if there is a flag I can place against any invoice that was paid 12 months ago. And then via a filter remove them from the graph?
So today date is 02/06/2015. I would want to mark all invoices with a flag upto 01/06/14 so they all appear on the graph - but May and April 2014 would be excluded.
Then when I run the report next month say - 7th of July 2015 - June 2014 will no longer appear on the graph but the 01/07/2014 and onwards would?
Hope that makes sense.

Related

SSRS date to and From parameters default to current financial year

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

Adding months to a date in access based on a number in another field

I have a database of documents with a "last reviewed" date field, another field has a number which states how many months until this document expires (6, 12, 18, 24)
I would like to display all the document which expire each month based on the review dates X the months till expire.
for example
if 3 documents have a date of 28/03/2017 and a 6 month review i would like a box on a menu which states 3 documents need to be reviewed in September.
any help would be great, thanks in advance
First find the future month to check, then calculate the expire date for the documents, and finally compare these.
Then you can use DCount in an expression for your textbox counting the documents:
=DCount("*","YourTable","DateDiff('m',DateAdd('m'," & [YourMonthsForwardTextbox] & ", Date()),DateAdd('m',[Expires],[Last Reviewed]))=0")

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.

Monthly Dates In MySQL

I'm having a bit of trouble currently. The system I'm trying to implement is a 'callback' system that will set callbacks against customers that will pop up on the system at the specified date.
One of the features is a reoccurring callback. The two options are monthly and yearly. I have the yearly ones working fine:
SELECT * FROM `callbacks` WHERE (
-- Yearly Callbacks
(DAYOFYEAR(`date_callback`) = DAYOFYEAR(NOW()) AND `occurs` = 'yearly') OR
-- Other Callbacks For Today
(DATE(`date_callback`) = DATE(NOW())))
But I'm having trouble visualising how to check if a callback that is monthly is due. It should only occur once every 30 days in the list (that uses the above query.) I was using DAYOFMONTH but I realised that if a callback was set for the 31st it wouldn't appear in the list for a few months at a time despite it being a monthly callback.
So if one is set for March 3rd 2013 and set for montly, it should appear in the results of the query if the date is:
March 3rd 2013
April 1st 2013
May 1st 2013
May 31st 2013
June 30th 2013
and so on. Has anyone dealt with this before?
I'd consider to use interval, something like
. . .
(DATE_ADD(NOW(), INTERVAL 1 MONTH))
. . .
See also this post.
Or - you can try (pseudocode)
now() - pre_saved_date % 30 (module of 30)
For % - use MOD function, like
select MOD(2, 3);
select 3 % 2;

Past 5 week calculation in WEBI (BO 4.0)?

I am facing issue in calculating past 5 week data based on current date (excluding currrent week)
For e.g:
Suppose we are in 40th week of this year, I need to get the sum of all the transactions for the previous 5 weeks (39, 38, 37, 36 & 35).
Currently calculating based on the calendar day but as Calendar day is giving the granular level of data, inorder to increase the performance I need to use the calendar week (sample data like (2012/40).
Is there a way to do this?
I'd construct a flag field (either in the back-end or in the universe) using datediff (in SQL Server terms).
Failing that, you could construct a variable in Web Intelligence using the Week function.
Pseudo-code but something like:
=IF(Transaction_Date < Week(CurrentDate()) AND Transaction_Date >= (Week(CurrentDate())-5); "TRUE"; "FALSE")