cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mahmoodhsaud
Helper IV
Helper IV

How to get the max value from CDS

Hi Everyone,

I wanted to get the max value based on the Account sequence.

If you see in the below table, max value in account sequence 1 is 3, similarly for account sequence 2 is also 3  and after getting the max value I need to set it to 0.  

mahmoodhsaud_0-1626703899173.png

Thanks in Advance,

Regards,

Mahmood

6 REPLIES 6
mahmoodhsaud
Helper IV
Helper IV

Hi @eric-cheng can you help me out with this

Hi @mahmoodhsaud ,

 

Are you using CDS or Excel?

 

You can try sorting by the column in descending order and getting the first value?

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Hi @eric-cheng,

I'm using CDS, the problem is in "Group Sequence" column we'll get more than one max value,

ex : If group1 has 1,2,3,4 and group2 has 1,2,3... I need to get 4 in group1 and 3 in group2

Hi @mahmoodhsaud ,

 

Ok, i may have misunderstood you earlier.  You want to get the max group sequence value of each distinct account sequence?

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Yea that's correct and replace the found value with 0

Hi @mahmoodhsaud ,

 

You can have a look at this article as its trying to do something similar by grouping and then adding.  In your case, you can look here for getting the max value instead of sum.  You will need to output the rows to an array first.

 

I was looking at FetchXml and it could potentially be used to group and aggregate or at least group your results first.  However, I dont know it well enough.

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

  

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,480)