cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Partisan
Post Partisan

Sort Drop Down by Date

Hi Community 

 

I have a drop down field on my SP list that is a date and a persons name that links to another list so that my datasets are linked.

 

On the form drop down it displays as follows but i need the options to display by moat recent date first, i cant find a way of implementing this sort within the app?

 

Kmayes_0-1603974369798.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @Kmayes 

In this case, you would need to extract the date values into a separate date column and to sort by that column.

Here's the formula that you can use to set the Items property of your dropdown.

 

SortByColumns(
              AddColumns(YourSPList, 
                         "DateValue", 
                          Date(Value(Mid(name,7,4)), Value(Mid(name,4,2)), Value(Left(name, 2)))
               ),
"DateValue",
Ascending
)

This formula calls AddColumns to add a date column called DateValue. It calls the Mid function to retrieve the date elements from the source column (name in this example).

 

timl_0-1603983035584.png

 

This example works on the assumption of the date format "dd/mm/yyyy". For the input format "mm/dd/yyyy", you can replace the section of the above formula with the line beneath.

Date(Value(Mid(name,7,4)),  Value(Left(name, 2)), Value(Mid(name,4,2)))

 

View solution in original post

3 REPLIES 3
Super User III
Super User III

Try:

Sort(YourList,DateColumn,Descending)

------------

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

@eka24 

 

I don't think this will work as the data  is pulling from another dataset. 

So data set one of an individuals name and date gets collected another column is then created by using concat to make a value 'Date - Name'.

 

Then on the second app it the has a drop down lookup box that is the above from dataset 1 to select which item this relates to.  Would you put this in the default property of the form?

Super User III
Super User III

Hi @Kmayes 

In this case, you would need to extract the date values into a separate date column and to sort by that column.

Here's the formula that you can use to set the Items property of your dropdown.

 

SortByColumns(
              AddColumns(YourSPList, 
                         "DateValue", 
                          Date(Value(Mid(name,7,4)), Value(Mid(name,4,2)), Value(Left(name, 2)))
               ),
"DateValue",
Ascending
)

This formula calls AddColumns to add a date column called DateValue. It calls the Mid function to retrieve the date elements from the source column (name in this example).

 

timl_0-1603983035584.png

 

This example works on the assumption of the date format "dd/mm/yyyy". For the input format "mm/dd/yyyy", you can replace the section of the above formula with the line beneath.

Date(Value(Mid(name,7,4)),  Value(Left(name, 2)), Value(Mid(name,4,2)))

 

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (3,986)