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 :
Finance | Project Operations, Human Resources, ...
Answered

aot query with groupby on purchline table with sum causing extra rows

(0) ShareShare
ReportReport
Posted on by 20

I've created an aot query against the PurchLine table with a sum of LineAmount grouped by PurchId and am getting multiple rows (one per purchline record) when I check a view against the query.  Please advise.  Below is the query.  DataSource set to no Dynamic Fields.

pastedimage1678883905937v1.pngpastedimage1678884137185v2.png

I have the same question (0)
  • Martin Dráb Profile Picture
    237,829 Most Valuable Professional on at

    Can you please elaborate what you mean by "I am getting multiple rows (one per purchline record)" and "I check a view against the query"?

  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    So can you please tell me the exact issue you face here? As per given query it is giving 1 record per purch id as grouping on purchid with sum of line amount. Means

    PONum        totalamt

    PO00001       200000

    PO00002       30000

  • jason.bouchard Profile Picture
    20 on at

    I created an aot view against the query and checked the view in the table browser and see the results returning 1 record per purchline record.

  • jason.bouchard Profile Picture
    20 on at

    I thought the purchid is the link back to the purchtable records?  I want to get a sum for the entire purchase order of the line amounts.

  • jason.bouchard Profile Picture
    20 on at

    Yes per AOT the PurchId is the link back to purchtable.

    pastedimage1678886424479v1.png

  • Martin Dráb Profile Picture
    237,829 Most Valuable Professional on at

    Are you saying that the query work correctly and your problem lies in the view that you told nothing about?

  • jason.bouchard Profile Picture
    20 on at

    At this point I am not sure if the problem lies in the view or query.  Here is the view to the query.

    pastedimage1678887796636v1.png

  • Martin Dráb Profile Picture
    237,829 Most Valuable Professional on at

    Then I recommend forgetting the view for now and focusing on the query. If the query doesn't work correctly, there is no pointing in using it in a view, because it can't work either. And if it works correctly, you'll know that there is nothing to fix in the query and your problem must lie elsewhere.

  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    Can you please elaborate your issue? As per query it is returning data as expected. Now what's your issue in view? If you make us clear on this thing we can help you. If that is not expected then please let us know what is expected?

  • jason.bouchard Profile Picture
    20 on at

    As stated, when I create a query against the view as above, it is returning a record per PurchLine with the LineAmount for the PurchLine record.  That is not what I need, I need one record per PurchId with sum of LineAmount from PurchLine table grouped by PurchId.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 512 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 291 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans