Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

ForAll and multiple Sort values

Posted on by 121

I am using the following code to get the newest distinct value based on Unique GRS 

 

ForAll(
 GroupBy(
 LogDataALL,
 "GRS",
 "_items"
 ),
 First(
 Sort(
 _items,
 'Log Date',
 SortOrder.Descending
 )
 )
)

 

What i need to add is another Sort function that will show the oldest record 1st based on the unique values.

 

Any ideas welcome please

 

Categories:
  • Markswan20 Profile Picture
    Markswan20 121 on at
    Re: ForAll and multiple Sort values

    Thanks for the suggestion, this seems to have now lost the Unique validation from the GRS field and now hides many of the fields that are powered by the drop down.

     

    I use this in my visible field 

    HubSelection_1.Selected.Value in ThisItem.ManagerLevel

     

  • Re: ForAll and multiple Sort values

    Hi @Markswan20 ,

     

    How is the situation now?

     

  • Re: ForAll and multiple Sort values

    Hi @Markswan20 ,

     

    Do you want newest and oldest at the same time?

    Please try this:

    Ungroup(ForAll(
     Distinct(
     LogDataALL,
     GRS
     ) As C,
     Table(Last(
     Sort(Filter(
     LogDataALL,GRS=C.Value),
     'Log Date',
     SortOrder.Descending
     )
     ),
     First(
     Sort(Filter(
     LogDataALL,GRS=C.Value),
     'Log Date',
     SortOrder.Descending
     )))
    ),"Value")

     

  • Markswan20 Profile Picture
    Markswan20 121 on at
    Re: ForAll and multiple Sort values

    That's ok, by replacing First to Last it give me the oldest unique value instead of the newest.

  • Re: ForAll and multiple Sort values

    Sorry, I didn't notice that.

    I have just modified my formula, or you can replace First with Last in your formula.

  • Markswan20 Profile Picture
    Markswan20 121 on at
    Re: ForAll and multiple Sort values

    Thanks for the response Rimmon, this gives the same results as my code.

  • Re: ForAll and multiple Sort values

    Hi @Markswan20 ,

     

    Please try this:

     

    ForAll(
     Distinct(
     LogDataALL,
     GRS
     ) As C,
     Last(
     Sort(Filter(
     LogDataALL,GRS=C.Value),
     'Log Date',
     SortOrder.Descending
     )
     )
    )

     

     

     

    Best regards,

    Rimmon

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard