Cascading Parameter - reporting-services

In SSRS reporting, I have three parameters as mentioned below,
Period
Start date
End date
My scenario is,
"Period" parameter has four values:
Quarterly
Monthly
Weekly
Adhoc
For example if user runs report for this month:
when user select "Quarterly" values passed to other two parameters will be 01/04/2019 and 30/06/2017
when user select "Monthly" values passed to other two parameters will be 01/06/2019 and 30/06/2017
when user select "Weekly" values passed to other two parameters will be 01/07/2019 and 07/07/2017
when user select "Adhoc" , the parameter should accepts values from the user.
For quarterly, monthly and weekly default values should be passed to "Start Date" and "End date"

Related

Select values from Access 2010 query calculated field

I have a query in Access where I want to select a range of dates from a calculated field in the query.
The field is populated using the following expression:
DueDate: DateAdd("m",-([PMI job lookup table]![Frequency]),[Date])
I'd like to select everything from a certain month and year from this field.
For example I'd like to list all the jobs in say May 2014.
In your query, add this criteria for the field of DueDate:
Between DateSerial(2014,5,1) And DateSerial(2014,5+1,0)
This will filter for dates between 2014-05-01 and 2014-05-31.

given the start date & current date, how do i know if the current date is part of recurrence pattern

So I have a row which shows when it was created! (i.e. 12/1/2013), and I have recurring patterns with frequencies associated with it.
Frequencies are from 1 to 6 and Recurring Patterns are Daily, Weekly, Monthly, and Yearly.
So users can set up recurring like {Frequency:1, Recurrence: Monthly} or {Frequency:2, Recurrence: Monthly}
I need a query that will take the current and the created date, and see if current date falls under the frequency.
so if the Created Date: 12/1/2013, and Today: 2/1/2014, the {frequency: 2, Recurrence: Monthly} would be valid.
try this sqlFiddle it uses a function that checks to see if the given date is recurring for each row in schedule
Assuming:
Recurrence has days associated and is stored in the database as daily=1, week=7, month=31, yearly=365
That you want valid or invalid returned
That your dates are in standard mysql date format
Then the below will work:
To get the difference in days between two dates use the DATEDIFF() function
To get the absolute value of an int use the ABS() function
To get the remainder of a dividend and divisor use the MOD() function
Here is some example code:
SELECT
IF(MOD((ABS(DATEDIFF(createdDate,'2014-02-01'))/days),frequency)=0,'valid','invalid') AS result
FROM
schedule
INNER JOIN recurringtypes ON schedule.recurringtypeId=recurringtypes.id
EDITED: SQLFiddle

SSRS report calculate field

I have a requirement of creating an ssrs report that needs to be showed in a matrix in this format
Dataset includes the following fields
year, month, values, account name
report format is something like this:
current month | month ( last year)| difference in %
account name
how do I calculate field for month of previous year? because SSRs does not have case or where logic inbuilt?
If you are doing this in your dataset you can do
DATEADD(YY,-1,COLUMN)
This will change your date a year back.
If you want to do this in the Report Side You can create a new column and create a calculated field and use:
=DateAdd(DateInterval.Year,-1,ColumnName)
Same Effect

Row total for calculated fields using SSRS Report Builder 2.0 over SQL Server 2008

I have a SRSS (2.0) tablix where I need to total the rows at group level (Contract) and DataSet Level (All Contracts)
In the detail rows I have a cell that holds a 'contract cost', a cell holding 'contract term' (months), two cells containing 'contract start date' and 'contract end date' then 12 columns for the months (Apr to Mar) of a financial year.
Each cell in a detail row has an expression that calculates:
<if this month is in the contract period then 'contract cost / contract period = result>
The results in coloumns are totalled so thet each month has a total expenditure by individual contract and all contracts
But I can't find a way to total the rows. Contracts may start or end at any period through the Financial Year so I need to row-total each detail line.
On the SQL Server 2008 I don't have authority to create tables/views, temp or perm. Otherwise I'd do that.
Any ideas?
And I'd put up an example but can't seem to get an image uploaded and accepted.
Thanks for looking...even more gratitude for resolving.
Brian
you could create a a few variables and have them return the running totals
Public Shared TotalProdActual as double
Public Function AddTotalProdActual(ByVal balance AS double ) AS double
TotalProdActual = TotalProdActual + balance
return balance
End Function
Public Function GetTotalProdActual()
return TotalProdActual
End Function

Printing parameters in an Access parameter query

I am developing an Access report based on a query that has a date range as a parameter,
like this
Between [Enter Start Date (mm/dd/yyyy)] And [Enter End Date (mm/dd/yyyy)]
How do I include the values entered for the start date and the end date in the report?
Thanks in advance.
GRB
You have to select the input values as columns in the query, using the exact names like in the Where clause.
Your query will probably look something like this:
select
Column1,
Column2,
DateColumn
from
MyTable
where
DateColumn between [Enter Start Date (mm/dd/yyyy)]
and [Enter End Date (mm/dd/yyyy)]
To include the input values in the query, you have to change the query like this:
select
Column1,
Column2,
DateColumn,
[Enter Start Date (mm/dd/yyyy)] as StartDate,
[Enter End Date (mm/dd/yyyy)] as EndDate
from
MyTable
where
DateColumn between [Enter Start Date (mm/dd/yyyy)]
and [Enter End Date (mm/dd/yyyy)]
You can use any alias you want for the input values (I used StartDate and EndDate), as long as the actual column names ([Enter Start Date (mm/dd/yyyy)] and [Enter End Date (mm/dd/yyyy)]) are exactly the same.
Of course this means that the query will contain the input values in every row, but you don't need to show them in every row in the report.
Just put the fields bound to StartDate and EndDate in the header or in the footer of the report, and the values will show up in the report only once.
DoCmd.OpenReport has some additional parameters for the filter, a where clause and most importantly OpenArgs. During the report load event you can capture these arguments to customize the Data Source for your report (EG: The range to select from) and set the value of Labels on the report to the input provided prior to opening up the report.
http://msdn.microsoft.com/en-us/library/bb238032%28v=office.12%29.aspx provides an overfiew of this functionality.
I envision a form where the user selects a date range from and hits OK. The report is called to open through the button click event and the date range (once validated on that end) is passed in through OpenArgs.
Also, you could just use the overloads to set the date range in the where/filter parameters and pass the full date range into OpenArgs such as "January 1 - January 31" and assign it to the Label.Text for the label on the report