cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

how to Filter the first id each Group after applying Group by

Hi all,

 

any one please suggest the formula to filter the  first id iof Each group after applying the Group by.

 

Source Table:

Id   ,  Value

101,AST

106,AST

114,AST

126,Bottle

129,Bottle,

130,Nike,

142,Nike

 

Filter Table Should be:

 

101,AST

126,Bottle

130,Nike

 

Please proivide any solution to achieve this.

 

 

 

3 REPLIES 3
Mike8
Solution Sage
Solution Sage

Hello,

I think that it can be improved but the following expression can solve your issue..
Gallery1.Items = ForAll(Distinct(A,Value),LookUp(A,Id=Min(Filter(A,Value=Result),Id)))

Meneghino
Community Champion
Community Champion

Here is a suggestion that only requires reading the source table once:

 

AddColumns(
    GroupBy(
        SourceTable,
        "Value",
        "AllRows"
        ),
    "MinId",
    Min(AllRows, Id)
    )

 The result will contain the AllRows column, but this can be ignored.

I think Meneghino's solution is better. You should use that one.
You can use the DropColumns() function to get rid of the AllRows column if you want to.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (17,082)