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

Sort Dropdown with Custom Sort

I need to custom sort my scenarios because 10 is showing before scenario 2 because of the one. I am trying to use this formula, but I am not sure what I am missing. SortByColumns( GUAT, Scenario, [ Scenario 1,Scenario 2,Scenario 3,Scenario 4,Scenario 5 ] )

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Hi @powerapps890 ,

 

Do you want to sort the items in the dropdown box? Are the Items actually be {scenario 1, scenario 2, scenario 3, scenario 4, scenario 5}?

 

You can leverage below formula to sort the table by a single column table, but needed to Quote the column name and field contents of the single column table:

 

SortByColumns( GUAT, “Scenario”, [ “Scenario 1”,”Scenario 2”,”Scenario 3”,”Scenario 4”,”Scenario 5”])

 

But since you have 14 scenarios to be sort, it is a little too complicated to list all items in the formula. Please try below formula to sort by a single number value split from the items:

 

Sort(AddColumns(coll,"Number",Last(Split(ThisRecord.Value," ")).Result),Value(Number))

 

If they are not exact what you listed, please show me the details about the items. 

 

Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution  to help the other members find it more.

View solution in original post

4 REPLIES 4
Highlighted
Helper II
Helper II

Can you update names to 01, 02, 03?

Highlighted

Yes, I did that I dont really like the look of it. This is my items for the gallery - Filter(
collGUAT2MasterData,
If(
IsBlank(ComboBox1_3.Selected.Result) || ComboBox1_3.Selected.Result = "All",
true,
C4 in ComboBox1_3.SelectedItems
) && If(
IsBlank(Dropdown1_1.Selected.Result) || Dropdown1_1.Selected.Result = "Scenario",
true,
C5 in Dropdown1_1.Selected.Result
) && If(
IsBlank(Search__1.Text),
true,
Search__1.Text in C2
) && If(
IsBlank(ComboBox1_4.Selected),
true,
C3 in ComboBox1_4.SelectedItems.Value
)
). The dropdown is dropdown1_1 and then in onvisible I have Collect(
coll,
Sort(
Distinct(
GUAT2,
Scenario
),
Result
)
); and ClearCollect(
coll,
{Result: "Scenario"}
); so the items for the dropdown are coll. I really don't want the 0 in front of it. @eliz_talent 

Highlighted

What I can suggest, according to the Power BI logic of sorting, is that the solution could be adding a column that will match usual order 1,2,3,4,....

So, you need to store this column together with your items

Highlighted
Microsoft
Microsoft

Hi @powerapps890 ,

 

Do you want to sort the items in the dropdown box? Are the Items actually be {scenario 1, scenario 2, scenario 3, scenario 4, scenario 5}?

 

You can leverage below formula to sort the table by a single column table, but needed to Quote the column name and field contents of the single column table:

 

SortByColumns( GUAT, “Scenario”, [ “Scenario 1”,”Scenario 2”,”Scenario 3”,”Scenario 4”,”Scenario 5”])

 

But since you have 14 scenarios to be sort, it is a little too complicated to list all items in the formula. Please try below formula to sort by a single number value split from the items:

 

Sort(AddColumns(coll,"Number",Last(Split(ThisRecord.Value," ")).Result),Value(Number))

 

If they are not exact what you listed, please show me the details about the items. 

 

Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution  to help the other members find it more.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,202)