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

Month Name Sort in Drop Down from Sharepoint Lookup Column

Hi all,

 

I have a Sharepoint list that has a lookup column from a Months Table. In the log form that I created that has the Month drop down from the lookup column, the column is not showing the months in the correct order. I have researched on here and found a couple sort drop down month column entries, but those did not fit my scenario. I have tried several different variations within the "Items" value of the drop down to no avail. The list that is tied to the form is brand new and does not have data in it yet. Any help would be appreciated. So far I have tried:  

 

Sort(Choices([@'SP List'].Month), Text("SP List.Month", "[$-en-US]mmm"), Ascending)

 

and it does not sort or do anything.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
TheRobRush
Super User
Super User

Biggest issue there I assume would be that months are not in alphabetical order, and since its technically just a collection of strings you wouldn't have much to sort them by.

 

You could do it like this

 

Sort(
ForAll(
   //////MonthTest is a collection of month names I made for this test
   MonthTest, 
   /////MonthName is the name of the column in that collection, this & MonthTest are 
   ////the parts you would need to switch to match YOUR list of months
             {     
                   /////First we collect the month name
                   Month:MonthName,
                   ///Next we set its order value
                   Order: Switch(
                              MonthName,
                              "January", 1,
                              "February", 2,
                              "March", 3,
                              "April", 4)}), 
     ///Last step is to tell this dropdown to sort by the order column we set
                   Order, Ascending)

 

Gives us a dropdown of months, sorted in their calendar order

 

TheRobRush_0-1670259497386.png

 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

View solution in original post

3 REPLIES 3
TheRobRush
Super User
Super User

Biggest issue there I assume would be that months are not in alphabetical order, and since its technically just a collection of strings you wouldn't have much to sort them by.

 

You could do it like this

 

Sort(
ForAll(
   //////MonthTest is a collection of month names I made for this test
   MonthTest, 
   /////MonthName is the name of the column in that collection, this & MonthTest are 
   ////the parts you would need to switch to match YOUR list of months
             {     
                   /////First we collect the month name
                   Month:MonthName,
                   ///Next we set its order value
                   Order: Switch(
                              MonthName,
                              "January", 1,
                              "February", 2,
                              "March", 3,
                              "April", 4)}), 
     ///Last step is to tell this dropdown to sort by the order column we set
                   Order, Ascending)

 

Gives us a dropdown of months, sorted in their calendar order

 

TheRobRush_0-1670259497386.png

 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

@TheRobRush 

 

Should I be inserting "Choices('SP List'.Month)" where you have MonthTest? Also, after I input the "{", it wants me to use a ThisItem.... 

Just for clarification, this drop down is from a Sharepoint List and that Sharepoint list has a Month column that is a lookup from a table called "Months". That table is laid out with two columns, the Month Name and the Month Number. 

TheRobRush
Super User
Super User

Yah, whatever your source will be goes in replacement of MonthTest. If checking an entire list of items, just the list name, then reference the rest in the {} section below. If a specific record something more liek the choices(record.column) will suffice. after the { you will start with Month: followed by a formula to set month name so should be  something like Value(? I think, depends on what chocie column tables are laid out like, I THINK they use Value:"Choice" format so something like Month:Value,Order:Switch based on value of month namme

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,538)