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)

Not getting Correct result in SSRS Fetch XML Report with Date range

(0) ShareShare
ReportReport
Posted on by 3,355

Hi Expert,

I have created a SSRS report fetching cases in a date range which has 4 parameters (Start Date, End Date, Status, Priority). Now below is the detail of my report. The issue is with Date. The report is not retrieving all the record in date range. The query is giving correct result in Query designer but while doing preview all the records are not coming. In advanced find the record are coming but not in report. Please suggest where am I missing.

=cdate(Format(DateAdd("M", -1, Today),"yyyy-MM-dd")) --> default value for @startdate

=cdate(Format(Today,"yyyy-MM-dd")) -->  default value for @enddate

=Format(Parameters!startdate.Value, "yyyy-MM-dd") --> default value for @startdatevalue =Format(Today,"yyyy-MM-dd")) --> default value for @enddatevalue

Parameters:

@startdate= DateTime

@enddate=DateTime

@startdatevalue= Text (hidden)

@enddatevalue=Text (hidden)

FetchXml:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">   <entity name="incident" >    <attribute name="createdon" />  <attribute name="createdby" />  <attribute name="modifiedon" />  <attribute name="modifiedby" />  <attribute name="ticketnumber" />  <attribute name="title" />  <attribute name="statecode" />  <attribute name="prioritycode" />  <attribute name="customerid" />  <attribute name="firstresponsesent" />  <attribute name="lastonholdtime" />   <attribute name="kbarticleid" />  <attribute name="ownerid" />          <order attribute="createdon" descending="true" />     <filter type="and">                <condition attribute="createdon" operator="on-or-after" value="@startdatevalue" />       <condition attribute="createdon" operator="on-or-before" value="@enddatevalue" />       <condition attribute="prioritycode" operator="in" value="@priority" />       <condition attribute="statecode" operator="in" value="@status" />           </filter>   </entity> </fetch>

 

Regards,

Saroj

*This post is locked for comments

I have the same question (0)
  • Inogic Profile Picture
    703 on at
    Hi,
     
    It is a common behavior with SSRS that the report does not show all the records n preview mode when we have a large dataset.
     
    You can import the report into the environment and check if it shows the correct details.
     
    Thanks,
    Sam
  • Saroj Das Profile Picture
    3,355 on at

    Hi Sam,

    Thank you for your time and reply. I did that also but the result is same and also strange. Please have a look at the image below. and please suggest a solution. Is this taking 11 and 12 date as 1. So strange.

     

    3173.report.JPG

     

    Regards,

    Saroj

  • Suggested answer
    Saroj Das Profile Picture
    3,355 on at

    Hi Experts,

    i got the issue in my report. I had the issue in the Data Set filter. I choose CreatedOnValue instead of createdOn field and i got the result as expected. Please check the below image.

    DS_2D00_Prop.JPG

    One more trick here. As the operator is used as Between, it was skipping the first record and last record so i used the below expression for from date and To date field. So that the actual first date will be 1 day before the selected first date in Calendar and also Last date will be 1 day ahead of selected end date.

    From Date: =DateAdd("d",-1,Parameters!startdate.Value)

    To Date: = =DateAdd("d",1,Parameters!enddate.Value)

    Hope this will help someone.

    Thanks,

    Saroj

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