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 / Sort gallery by month.
Power Apps
Answered

Sort gallery by month.

(0) ShareShare
ReportReport
Posted on by

Hello Guys,

 

New powerapps user here, I Would like to get help on how can I insert sorting codes on my current formula on my Gallery view.

 

If(
varDatacount < VarDelegationLimit,

Filter(
Filter(
'Luzon NAFS Dacion',
STATUS.Value = ComboBox1.Selected.Value || ComboBox1.Selected.Value = Blank()),

FilterByNameDacion.Text in Title || FilterByNameDacion.Text in STATUS.Value || FilterByNameDacion.Text in 'ACCOUNT NAME'),
Filter(
'Luzon NAFS Dacion',
STATUS.Value = ComboBox1.Selected.Value || ComboBox1.Selected.Value = Blank())

)

 



 

nmlsanmiguel_0-1681289230747.png

 

 

Hoping for your kind assistance.

 

Thank you and Stay Safe!

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,051 Most Valuable Professional on at

    Hi @nmlsanmiguel ,

    The problem you have here is that while you have that in filter in the statement, the query is not Delegable, so you might as well do this

    With(
     {
     wData:
     Filter(
     'Luzon NAFS Dacion',
     STATUS.Value = ComboBox1.Selected.Value || 
     ComboBox1.Selected.Value = Blank()
     )
     },
     Sort(
     Filter(
     wData,
     FilterByNameDacion.Text in Title || 
     FilterByNameDacion.Text in STATUS.Value || 
     FilterByNameDacion.Text in 'ACCOUNT NAME'
     ),
     YourSortField,
     YourSortDirection
     )
    )
    

    You can try this as well

    If(
     varDatacount < VarDelegationLimit,
     Sort(
     Filter(
     'Luzon NAFS Dacion'
     STATUS.Value = ComboBox1.Selected.Value || 
     ComboBox1.Selected.Value = Blank()
     ),
     YourSortField,
     YourSortDirection
     ),
     Sort(
     Filter(
     'Luzon NAFS Dacion'
     (	 
     STATUS.Value = ComboBox1.Selected.Value || 
     ComboBox1.Selected.Value = Blank()
     ) &&
     (
     FilterByNameDacion.Text in Title || 
     FilterByNameDacion.Text in STATUS.Value || 
     FilterByNameDacion.Text in 'ACCOUNT NAME'
     )
     ),
     YourSortField,
     YourSortDirection
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • nmlsanmiguel Profile Picture
    on at

    Hi Sir, appreciate the help, but when I am trying the IF code you have shared, I can't find the Sort Field which was a Date column. Thank you.

  • WarrenBelz Profile Picture
    156,051 Most Valuable Professional on at

    Hi @nmlsanmiguel ,

    I am not sure what you mean - you just need to replace YourSortField with your field name (and also the direction)

  • nmlsanmiguel Profile Picture
    on at

    Hi Sir, I am Still getting an error upon doing,

     

    nmlsanmiguel_0-1681350751617.png

     

  • WarrenBelz Profile Picture
    156,051 Most Valuable Professional on at

    @nmlsanmiguel ,

    There is no Sort criteria in that code and I do not see any error lines - have you typed the full code in ?

  • nmlsanmiguel Profile Picture
    on at

    This code works for me! Thank you.

     

     

     Would also like to know if how can I filter dates automatically for the current month? Thank you. 

  • WarrenBelz Profile Picture
    156,051 Most Valuable Professional on at

    Hi @nmlsanmiguel ,

    Note this is not Delegable

    Month(YourDateField) = Month(Now()) && Year(YourDateField) = Year(Now())
  • nmlsanmiguel Profile Picture
    on at

    oh no, How can I make it delegable? Thank you

  • WarrenBelz Profile Picture
    156,051 Most Valuable Professional on at

    @nmlsanmiguel ,

    If you set up two dates with the start and end of the current month, you can query between them - First of month is

    Date(
     Year(Now()),
     Month(Now()),
    )

    Last day of month (a bit trickier)

    If(
     Month(Now()) = 12,
     Date(
     Year(Now() + 1),
     1,
     1
     ) -1,
     Date(
     Year(Now()),
     Month(Now() + 1),
     1
     ) - 1
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 364 Most Valuable Professional

#2
11manish Profile Picture

11manish 186

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 105 Super User 2026 Season 1

Last 30 days Overall leaderboard