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 :
Power Platform Community / Forums / Power Apps / Filter gallery to show...
Power Apps
Answered

Filter gallery to show the most recent entry for a country & Brand basis QTR column

(0) ShareShare
ReportReport
Posted on by 52

My app takes only one entry within a QTR for a Country and Brand, so for UK in QTR2 of 2023 the app will take only one entry per brand.
Now I want my gallery to show only the most recent entry basis the QTR field so that there is only one line item per Country & Asset.
Also pls note my gallery is allowing filtering using 3 dropdowns so that part will remain as is.

Data as of now (Recent items highlighted):

OnlyGooner_1-1689836500227.png

Desired output:

OnlyGooner_2-1689836553209.png

 

 

Categories:
I have the same question (0)
  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @OnlyGooner ,

     

    We created the data source below.

    vhanytianmsft_0-1689838242828.png

     

    Please this in the Items of Gallery:

    ForAll(Distinct('0720-2',Concatenate(Project,Region,Country)),
     LookUp(SortByColumns('0720-2',"QTR",SortOrder.Descending),Value = Concatenate(Project,Region,Country)))

    vhanytianmsft_1-1689838301362.png

     

    Hope this will help you,

    Best Regards,
    Tina

     

  • victorcp Profile Picture
    2,350 Moderator on at

    Hi,

    have you tried using GroupBy() function?

     

    GroupBy(
     DataSource,
     "QTR", /*name of the column*/
     "Group"
    )

     

     

    Then use "Last()" function on a label to get the most recent value:

     

    Last(ThisItem.Group).Region
    Last(ThisItem.Group).Country
    Last(ThisItem.Group).Product

     

     

    I hope it helps 🙂

  • OnlyGooner Profile Picture
    52 on at

    Can you pls help me in combining your code with the below to allow the use of dropdowns:

    If(
    IsBlank(cmb_Country_gal) Or IsBlank(cmb_Brand_gal) Or IsBlank(cmb_regn_gal) Or IsBlank(cmb_qtr_gal),
    Filter(
    'MyDataSource',
    IsBlank(cmb_regn_gal.Selected.REGION) || false || Region = cmb_regn_gal.Selected.REGION,
    IsBlank(cmb_Country_gal.Selected.Result) || false || Country = cmb_Country_gal.Selected.Result,
    IsBlank(cmb_Brand_gal.Selected.Result) || false || Brand = cmb_Brand_gal.Selected.Result
    ),
    'MyDataSource'
    )

  • Verified answer
    v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @OnlyGooner ,

     

    Of Course!

    I made a simple for you to Test if it worked.

    You just need to replace 'MyDataSource' the formula you wrote into

    ForAll(Distinct('0720-2',Concatenate(Project,Region,Country)),
     LookUp(SortByColumns('0720-2',"QTR",SortOrder.Descending),Value = Concatenate(Project,Region,Country)))

     

    Here is the Test.

    vhanytianmsft_0-1689843125341.png

     

    Hope this will help you,

    Best Regards,
    Tina

     

  • OnlyGooner Profile Picture
    52 on at

    Got it working now, I was being a noob.

    Many Thanks

  • OnlyGooner Profile Picture
    52 on at

    One quick help on this, instead of QTR that holds numeric values, if I have to do it on another column that holds alphanumeric values like Q2'2023, how do I do it?

  • OnlyGooner Profile Picture
    52 on at

    @v-hanytian-msft Pls respond. If anyone else can help it will be greatly appreciated.

  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @OnlyGooner ,

     

    Please try this:

    Concatnate("Q",Left(String,1),"'",Right(String,4))

     

    Hope this will help you,

    Best Regards,
    Tina

  • OnlyGooner Profile Picture
    52 on at

    @v-hanytian-msft 
    Original formula was this, I tried the concatenate formula from end as well to replace "QTR_Year" within SortBy Columns but it doesn't work.
    Not use If need to use Addcolumns here? Pls help.

     

      ForAll(Distinct('Impact Metrics Performance Input App',Concatenate(Asset,Region,LOC)),
        LookUp(SortByColumns('Impact Metrics Performance Input App',"QTR_Year",SortOrder.Descending),Value = Concatenate(Asset,Region,LOC))

  • OnlyGooner Profile Picture
    52 on at

    Don't bother, picked up 'Created date' col available in my SharePoint list

    Thank you 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 414

#2
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 315 Super User 2026 Season 1

Last 30 days Overall leaderboard