web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Fetch Least sales price record from sales trade agreements

(0) ShareShare
ReportReport
Posted on by 642

Hi Experts,

I have a requirements that I have some customer accounts with multiple sales prices for an item in the same period. I need to take the least sales price record from the table PriceDiscAdmTrans. This is to be added in a report.  

1. Customer A with sales price 100

2. Customer A with sales price 200

3. Customer B with sales price  150

Output should be Customer A with 100 & Customer C with 150. how can I get this output using select statement?. 

Thanks in advance. 

I have the same question (0)
  • Suggested answer
    WillWU Profile Picture
    22,363 on at

    Hi AX Beginnner,

    See the T-SQL:

    SELECT accountcode,
    AMOUNT
    FROM (SELECT *,
     ROW_NUMBER() OVER (PARTITION BY accountcode ORDER BY amount asc) AS num
     FROM PriceDiscAdmTrans) t
    WHERE num=1

  • D365  beginner Profile Picture
    642 on at

    Hi Will Wu,

    Thanks for the reply.

    how can I use the same in X++ ?

  • WillWU Profile Picture
    22,363 on at

    Hi AX beginner,

    The ROW_NUMBER doesn't exist in X++.

    You could create a view with a computed column as the data source of the SSRS, please have a look at Martin's blog:

    dev.goshoom.net/.../

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
SajeedMullaji Profile Picture

SajeedMullaji 312

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 284 Super User 2026 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 258 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans