Skip to main content
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Unanswered

How to retrieve top 15 total values of a field from list of opportunity records for specific month

(0) ShareShare
ReportReport
Posted on by 35

Hi Experts,

   I have a requirement to fetch top 15 values of a field for a particular month on opportunity form .

 Is it possible to achieve using fetch xml  ? Please suggest the best approach to implement .

Appreciate if you share the fetch xml for the same ?

  • LeoAlt Profile Picture
    16,331 Moderator on at
    RE: How to retrieve top 15 total values of a field from list of opportunity records for specific month

    Hi partner,

    For example, I want to get the top 5 opportunity records order by "createdon" and were created in Oct 2019, here is the sample fetchxml

    <fetch top="5" version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="opportunity">
        <attribute name="name" />
        <attribute name="customerid" />
        <attribute name="estimatedvalue" />
        <attribute name="statuscode" />
        <attribute name="opportunityid" />
          <condition attribute = 'createdon' operator='between'>
            <value>2019-10-01 00:00:00</value>
            <value>2019-10-31 23:59:59</value>
          </condition>
        <order attribute="createdon" descending="true" />
      </entity>
    </fetch>

    Hope it helps.

    Best Regards,

    Leo

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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 51 Most Valuable Professional

#2
Ramesh Kumar Profile Picture

Ramesh Kumar 42

#3
David Shaw_UK Profile Picture

David Shaw_UK 27

Featured topics

Product updates

Dynamics 365 release plans