Skip to main content

Notifications

Microsoft Dynamics CRM forum
Suggested answer

Orderby on aggregate query (alias required)

Posted on by 25

Hi there,

I am trying to apply an orderby to an aggregate query and am getting the following error message back:

{"error":{"code":"0x80041134","message":"An alias is required for an order clause for an aggregate Query."}}

I understand what the error message is saying but am unclear on how to actually resolve the issue. Here is an example of the query:

.../incidents?$filter=statecode eq 0&$groupby((statuscode), aggregate($count as total))&$orderby=statuscode desc

Regards,
Andy

  • Suggested answer
    RE: Orderby on aggregate query (alias required)

    Hello Andy,

    please have a look in the following:

    Query Data using the Web API (Microsoft Dataverse) - Power Apps | Microsoft Docs

    There are a lot of example that can help you to build your query correctly.

    Thanks

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans