web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Date Parameters ignored on SSRS

(0) ShareShare
ReportReport
Posted on by 190

Hi 

I am having trouble with SSRS reports I have 2 date field parameters and when i run the report it ignores the 2 dates i input and displays all the records. I want it to only show me records where the sab_enddate is within 2 dates.

WHERE (ST.sab_shortcode LIKE 'SB%') AND (SP.sab_enddate BETWEEN @EndDateFrom AND @EndDateTo)

Dataset 1: 

SELECT COUNT(*) AS ContactCount, ST.sab_shortcode AS ShortCode, C.sab_Address1_CountryIdName AS Country from Filteredsab_subscriptionplan SP INNER JOIN Filteredsab_subscriptiontype ST
ON SP.sab_subscriptiontypeid = ST.sab_subscriptiontypeid INNER JOIN FilteredContact C ON
C.ContactId = SP.sab_primarycontactid
WHERE ST.sab_shortcode like 'SB%'
GROUP BY C.sab_Address1_CountryIdName, ST.sab_shortcode

Dataset 2: (WHICH HAS THE PARAMETER)

SELECT SP.sab_name AS Subscription, SP.sab_startdate AS SDate, SP.sab_enddate AS EDate, ST.sab_name AS SubscriptionType, ST.sab_shortcode, C.fullname, C.sab_address1_countryidname
FROM Filteredsab_subscriptionplan AS SP INNER JOIN
Filteredsab_subscriptiontype AS ST ON SP.sab_subscriptiontypeid = ST.sab_subscriptiontypeid INNER JOIN
FilteredContact AS C ON C.contactid = SP.sab_primarycontactid
WHERE (ST.sab_shortcode LIKE 'SB%') AND (SP.sab_enddate BETWEEN @EndDateFrom AND @EndDateTo)

*This post is locked for comments

I have the same question (0)
  • Gopalan Bhuvanesh Profile Picture
    11,401 on at

    Hi

    Do you get the right records if you run the query (with the same date range) in MSSQL Management studio?

  • Shane Brown Profile Picture
    190 on at

    It works in Management Studio when i set the dates but in the report it does not work.

  • joman Profile Picture
    617 on at

    The only way, i see, is open SQL server profiler, and find there a query, when SSRS builds Report.

    Then you can find out what is happens.

  • Verified answer
    Shane Brown Profile Picture
    190 on at

    Fixed by scrapping the second Dataset

  • Suggested answer
    Community Member Profile Picture
    on at

    I always tried my best to stick to only one main dataset when trying to develop a SSRS report. By doing this it gives me the flexibility to remove the criteria from the report and pushing the criteria to the users by giving them the control of pre-filter (they can set whichever date they want).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans