-1

I have requirement where I need to allow the user to select at any time for 1 year worth of data and restrict the user to select start and end dates within the year selected in year parameter?

Any insight would really help!!

sai
  • 1
  • 3

2 Answers2

0

You can build a custom dataset based on your requirements (year parameter, one year limit etc) and instead of using date parameter, use text parameter and drop down list to values for date selection. Make sense?

And to build a custom dataset, you can use help from the following answer:

How to list all dates between two dates

ViKiNG
  • 1,294
  • 2
  • 19
  • 26
  • how can I create start and end dated dataset per select year?... each year have 365 days... displaying 365 days as drop down list is not make much sense.. – sai Jul 12 '17 at 22:04
  • Correct but so far I'm unable to find another way to do that. let's wait for some other answer? Or I'll try alternatives in spare time. – ViKiNG Jul 12 '17 at 22:51
0

First create a parameter (begdate)as Data Type: Date/Time and populate the available values, Label as YYYY and Value dd/mm/yyyy - (1st of the 1st month for each year) Example below: enter image description here

In your dataset query you can reference this user selected parameter by inserting a HAVING clause:

for example:

HAVING (tbl_XYZ.AdmissionDate BETWEEN DATEADD(YEAR, DATEDIFF(YEAR, 0, @begdate), 0) AND DATEADD(yy, DATEDIFF(yy, 0, @begdate) + 1, - 1))

SuperSimmer 44
  • 964
  • 2
  • 7
  • 12
  • user can search the data for any year... as years changes new years adding up... so specify the values is not an option for me – sai Jul 13 '17 at 13:11
  • Would it be more useful to select/input a start date and the report then automatically equates the end date as +365days (even if it crosses into the next year?) – SuperSimmer 44 Jul 13 '17 at 17:17