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)

CRM Report

(0) ShareShare
ReportReport
Posted on by 270

Hi Guys

I'm not sure if this is relevant to this group but i need help. I'm busy creating report for client in ssrs and I'm struggling somehow.

I want to write report that will pull the records from the table that i call History account that store history records. 

The following is what i have done.

My Query: Select A,B,C

Dadiff(month,C,SYSDATETIME()) AS DateDifference

From Tablename

C is a datefield.

Then i want my report to filter records for 12 months which is calculated by C and current date only.

I tried to use this query  i failed.

My Query: Select A,B,C

Dadiff(month,C,SYSDATETIME()) AS DateDifference

From Tablename

Group By C,A,B

Having Dadiff(month,C,SYSDATETIME())=12

C is a datefield.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Use query like this:

    select A, B, C, Datediff(month,C,SYSDATETIME()) AS DateDifference

    from filteredIncident

    where Datediff(month,C,SYSDATETIME()) = 12

  • Verified answer
    Samrando Profile Picture
    270 on at

    I got it guys. If you mind need to do something like this in future refer below

    DECLARE @datetotal INT

    SELECT @datetotal = (SELECT DATEDIFF(month,C,SYSDATETIME()))

    IF @datetotal = 12

    SELECT A,B,C

    FROM Tablename

  • Samrando Profile Picture
    270 on at

    Thanks Saad, but i ran into error trying that one. It just showed error on the equal sign. I think if you do that one like:

    Declare DateDifference INT

    select A, B, C,DateDifference= Datediff(month,C,SYSDATETIME())  

    from filteredIncident

    where DateDifference = 12

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