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 ] )
Solved! Go to Solution.
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.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
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
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.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
User | Count |
---|---|
159 | |
85 | |
68 | |
63 | |
61 |
User | Count |
---|---|
209 | |
151 | |
93 | |
81 | |
69 |