cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powerapps890
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
v-jefferni
Community Support
Community Support

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
eliz_talent
Helper II
Helper II

Can you update names to 01, 02, 03?

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 

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

v-jefferni
Community Support
Community Support

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Top Kudoed Authors
Users online (59,179)