cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
asdaf
Helper I
Helper I

Sort Gallery Dates in order

Hello,

 

I have the following formula for Gallery items:

 

ForAll(Filter(Distinct(datasource,'Date'),Result<>Blank()),First(Filter(datasource,'Date'=Result))). Can anyone help me with the syntax for arranging the dates in order. 

 

5 REPLIES 5
StalinPonnusamy
Community Champion
Community Champion

Hi @asdaf

 

Gallery Items Property for Simple Sort with Date Column

With(
    {
        sData: Sort(
            SPListName,
            'DateColumnName',
            If(
                SortDescending1,
                Descending,
                Ascending
            )
        )
    },
    sData
)

 

asdaf
Helper I
Helper I

asdaf_1-1627900699506.png

 

I am getting an error message after If function. Any ideas?

StalinPonnusamy
Community Champion
Community Champion

Hi @asdaf 

 

Looks like you don't have a local Variable for sorting functionality. So change to

 

 

With(
    {
        sData: Sort(
            'Issue tracker',
            Created,
            Descending
        )
    },
    sData
)

 

 

StalinPonnusamy
Community Champion
Community Champion

Hi @asdaf 

 

If you want sorting functionality then add an icon like below with the command. 

UpdateContext({SortDescending1: !SortDescending1})

StalinPonnusamy_0-1627911082854.png

 

If you have this icon (Sorting functionality) then the previous query should work.

StalinPonnusamy
Community Champion
Community Champion

Hi @asdaf 

 

Please let us know if anything needs on your post.

 

If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,782)