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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Max of Two Aggregation Fields in D365 View.

(0) ShareShare
ReportReport
Posted on by 65

Hi Everyone,

I want to get the Max of Field of two Aggregate Fields in my View. I am trying to do it through computed column but can't figure out the way to get the Max Aggregate Fields of my view in the View Method. So, I have two questions:

How to reference the Aggregate View Fields in View Method?
What's the best way to get the Max of two View Aggregate Fields other than View Method?

Note: View's query already has a Group By.

Thanks.

I have the same question (0)
  • OsamaAG Profile Picture
    65 on at
    RE: Max of Two Aggregation Fields in D365 View.

    goshoom can you help me with this please.

  • Verified answer
    Martin Dráb Profile Picture
    236,353 Most Valuable Professional on at
    RE: Max of Two Aggregation Fields in D365 View.

    A computed column method is a method generating a piece of T-SQL code. Therefore you need to decide what SQL code you want to generate before you start writing X code for it. Have you done that?

    The easiest way would be using GREATEST() function, but while it should work in Azure SQL, you would have a problem in Tier1 environments, if they aren't on SQL Server 2022.

    What you could do instead is using select from values. For example:

    (select max(n) from (values (max(num1)), (max(Num2))) as t(n))

    Use the example to prepare SQL for your particular situation and test it before writing X code for it,

  • OsamaAG Profile Picture
    65 on at
    RE: Max of Two Aggregation Fields in D365 View.

    Thanks goshoom .

    Yes, I was writing SQL before I started implementing in X++, what I was trying to do was to reference the Already Aggregated fields of the views but your method also works in my case.

    Thanks again.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,028

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 579 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans