Posted in Microsoft Dynamics XRM

Error in Fetch xml based report when implementing aggregates



Ever faced the above two errors?? and really in a need of some solution? Don’t worry… here you will find the solution.

The scenario is such that you have downloaded your fetchxml from advance find view, made it aggregate = “true” and added the code for count/sum/groupby etc,  copied it and pasted int the query area of your report. And when you execute the query, this dreadful error is popped up. What you need to do is just make sure of the following things:

a) you don’t have any orderby in your code, coz it doesn’t work with aggregates without aliases

b) you should be having either group by = “true” or aggregate = “sum”/”count” (as per your need) with each attribute you add along with the alias defined. Remember, you have to add “group by” with all attributes that you have got in your fetchxml query.

here’s an example:


also with this query you can have your data grouped month/year wise

So.. done with the error fixes ? Happy coding! 😀



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s