cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
_kikilalaaa
Helper V
Helper V

Sort Month Drop Down Chronologically

Hi all!

 

I have a drop down in my power apps and the items are the months column from SharePoint. How do I sort the month record chronologically?

 

For example:

 

Jan

Apr

Dec

 

Right now, what I did is:

Sort(Distinct(Filter('SP LIST', Dept = varDept, Year = RecordedYear.Selected.Result), Month),Result,Descending)

 

But it sort the month alphabetically like this:

Jun

Jan

Apr

 

Any idea for this?

17 REPLIES 17

@WarrenBelz well said. Only reason I introduced a collection was to throw out an additional alternative. At the end of the day, it all depends on how the data and app are designed. And as always, there's always more than 1 ways to do something!

Thanks,
Hardit Bhatia
https://thepoweraddict.com

Thank you everyone!

 

I have tried @PowerAddict suggestions but I got the attached warning. I am not sure whether I write it wrongly or what. I filter the sharepoint list and then after that I filter the collections. 

 

For now, the solution I wanted is from @Eelman . I understand that date column will be very helpful but in my case, I do not require exact date so that is why I did not put date column. 

 

Thank you for your help. Have a nice day ahead!

@_kikilalaaa @Eelman @WarrenBelz @eka24

The only thing I would like to flag is that AddColumns is only partially delegable. What I mean by that is that parameters of AddColumns is delegable (or can be based on your data source and formula). However, irrespective of whether the parameters of AddColumns is delegable or not, AddColumns output is not. Which means it will always be subject to the non-delegation limit.

AddColumns used to be my favorite solution approach until I found this out the hard way. Reason why it was hard? Because this is one delegation issue for which the App Checker doesn't throw a delegation warning. That's why I call it the "Invisible Delegation Issue"!

Here is a link to my blog post about this: https://thepoweraddict.com/the-invisible-delegation-issue/

Just wanted to throw it out there so you can factor that in if it affects you.

Thanks,
Hardit Bhatia
https://thepoweraddict.com

Hi @PowerAddict ,

 

Yeah I encounter that warning before but I am still not sure what it is. Your post really help me to understand! However, I have 2 questions,

 

1. To confirm, does this means that if you set the limit to 10, they will only search up until 10 data for that particular column is it? 

For example, I have a record of year 2020 and the recorded months are Jan-Dec. However, Since the limit is 10, I can only see up until Oct, is it?

 

2. Is the limit set is applicable for each column or the sum of all records that I have? I have record of year from 2000-2020. When I set the limit to 10, am I able to find the record for 2020 and retrieve the months? 

 

To begin with, the default limit is 500. And it can be increased to 2000.

Now to answer your questions, if the count of results of the expression within your AddColumns function is more than 500 (if the limit is 500), you will get incorrect or incomplete results.

That should answer both your questions. Let me know if I wasnt clear in my response.

Thanks,
Hardit Bhatia
https://thepoweraddict.com

Okay, now I understand. So since I only want to search for months (which the max it would be 12), I think it is okay for me to use this method. But I will reconsider this for other things that might have a lot of records.  Thanks!!

@PowerAddict 

Nice article mate, thanks for the share. I rarely, if ever, use Search() but gave it a try on my test SP List and straight up got a delegation warning on a simple text field. Search mustn't work for SP?

 

I will keep the AddColumns tip in mind though. Thanks!

 

 

In and Search are not delegable with SharePoint. An alternate to Search is StartsWith when it comes to SharePoint.

AddColumns has troubled me a lot. So hopefully it wont trouble anyone else!

Thanks,
Hardit Bhatia

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 (3,401)