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)

Applying "Top N" filter to table with aggregated data

(0) ShareShare
ReportReport
Posted on by

I've read about the "Top N" filter not supporting aggregated data, so I suspect I may not be able to achieve what I'm trying to, however I'm hopeful someone may recommend an alternative approach to my problem?

I am showing the Top and Bottom performers over various periods of time. For example, the Top & Bottom performer in the last week, the last month, the last quarter and last year. I have one report with 8 different tables on it - 2 tables (Top & Bottom) for each time period.

I thus also have 4 different datasets in my report, each with a different "on-or-after" FetchXML date parameter to select the appropriate set of data for the time period being reported on.

Within my report, I calculate the performance achievement of each department and sort the results in descending order. This all works just fine.

I now need to show only the Top 5 departments in each table, and this is where I come unstuck.

If I use the Filter criteria on the Department field within the Row Group, I don't get the right result. From what I've read it looks like the filter is applied to the original dataset, and not the resulting aggregated list of Departments after I've calculated each one's performance.

I then tried adding a filter on the Tablix properties itself, again using filtering on the Top 5 Departments, but this then gave me a very strange results, showing only 1 Department.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    ManirajKV Profile Picture
    1,477 on at

    Hi William,

    you can use "count" for it. like below

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" count="10"> 


  • wi11iamr Profile Picture
    on at

    Thanks Maniraj, however as my fetchXML dataset currently returns all records (without any aggregation of the total records per department) I suspect setting the count parameter will only return the first 10 records? It sounds like I'm going to have to head down the path of aggregating the total number of records in my fetchXML statement, but this scares me a little from what I've been reading... :)

  • Suggested answer
    ManirajKV Profile Picture
    1,477 on at

    Yes. count will be applied at last. so you no need to worry.

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