cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Dlabar
Level 8

CDS List Records Action gives 502 Bad Gateway error when attempting to use Aggregation transformation with groupby

No matter what I've tried, I always get a 502 error when using the Aggregation transformation feature to attempt to get the number of leads per state.  

 

So something like this FetchXml:

 

 

<fetch top="50" aggregate="true" >
  <entity name="lead" >
    <attribute name="address1_stateorprovince" alias="StateCount" aggregate="count" />
    <attribute name="address1_stateorprovince" alias="State" groupby="true" />
    <order alias="StateCount" descending="true" />
    <order alias="State" />
  </entity>
</fetch>

This was what I was trying:  

groupby((address1_stateorprovince),aggregate($count as StateCount))

 

4 REPLIES 4
Community Support Team
Community Support Team

Re: CDS List Records Action gives 502 Bad Gateway error when attempting to use Aggregation transformation with groupby

 

Hi @Dlabar ,

 

I tested it on my side and the Aggregation transformation works fine.

34.PNG

Please refer to the link below to make sure that you use the formula is valid, as a reference, the field type I reference in the aggregate is the Number type.

http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs01/odata-data-aggregation-ext-v4....

Please take a try again.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dlabar
Level 8

Re: CDS List Records Action gives 502 Bad Gateway error when attempting to use Aggregation transformation with groupby

This is my attempt, maybe I have something wrong?  There is just 0 documentation on what this is supposed to be that I could find.image.png

Community Support Team
Community Support Team

Re: CDS List Records Action gives 502 Bad Gateway error when attempting to use Aggregation transformation with groupby

 

Hi @Dlabar ,

 

I just used the formula here to configure Aggregation transformation:

99.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dlabar
Level 8

Re: CDS List Records Action gives 502 Bad Gateway error when attempting to use Aggregation transformation with groupby

That helped...  This is the actual query that works for me:

 

groupby((po_companystate),aggregate(po_companystate with countdistinct as Count))

 

Currently there is a bug with using address1_stateorprovince that I'm currently working with support on, so I have created a duplicate field (po_companystate), and it is working fine.  Now my only problem is I can't do a descending on the aggregate

 

 

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,946)