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

Sort Month Name in Dropdown

I have a dropdown that filters from a CDS datasource on Date. I have converted from showing 11/2019 to be Nov 2019.  How can I sort the dropdown to based on Month instead of alphabetically.  See attachment. 

 

My filter formula: Sort(Distinct(Filter('Time Entries',msdyn_bookableresource.'Primary Email'=CurrentUser.Email),Text(msdyn_date,"[$-en-US]mmm") & " " & Text(msdyn_date,"[$-en-US]yyyy")),Result)

 

 

 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Sort Month Name in Dropdown

@yichingjc 

Have you tried my suggestion or are you just assuming it won't work?  I tested the idea on a small Collection of test data and it appears to work just fine.

 

 

Distinct(
    Sort(
        Filter('Time Entries',msdyn_bookableresource.'Primary Email'=CurrentUser.Email),
        msdyn_date
    ),
    Text(msdyn_date,"[$-en-US]mmm") & " " & Text(msdyn_date,"[$-en-US]yyyy"))
)

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

7 REPLIES 7
Highlighted
Super User
Super User

Re: Sort Month Name in Dropdown

@yichingjc 

Your functions are currently nested like this:

  • Sort
  • Distinct
  • Filter

 

Have you tried nesting them in this order instead?  My thought is the date should be sorted before it is converted to text by the 2nd argument of DISTINCT 

  • Distinct
  • Sort
  • Filter

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Helper I
Helper I

Re: Sort Month Name in Dropdown

@mdevaney  I need to sort the dropdown by Month name = Nov 2019, Dec 2019, Jan 2020, Feb 2020, Mar 2020 etc.  Using sort and sortbyColumn you can only do ascending or descending. 

Highlighted
Super User
Super User

Re: Sort Month Name in Dropdown

@yichingjc 

Have you tried my suggestion or are you just assuming it won't work?  I tested the idea on a small Collection of test data and it appears to work just fine.

 

 

Distinct(
    Sort(
        Filter('Time Entries',msdyn_bookableresource.'Primary Email'=CurrentUser.Email),
        msdyn_date
    ),
    Text(msdyn_date,"[$-en-US]mmm") & " " & Text(msdyn_date,"[$-en-US]yyyy"))
)

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

Highlighted
Helper I
Helper I

Re: Sort Month Name in Dropdown

@mdevaney I did try it. but I think my sorting was incorrect that's why it didn't work.  But yours did. Thank you! 

Highlighted
Super User
Super User

Re: Sort Month Name in Dropdown

@yichingjc 

Good to see its working now!

Highlighted
Helper I
Helper I

Re: Sort Month Name in Dropdown

@mdevaney I have another question on relating to Dropdown default.  I've used your code I'm able to sort by month (thanks) see screenshots.  Is it possible to set the Default to be the current month?

 

 
Highlighted
Super User
Super User

Re: Sort Month Name in Dropdown

@yichingjc 

You could likely change the Default property of the ComboBox to this code.

 

Text(Today(),"mmm yyyy")

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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