cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Joorge_c
Resolver I
Resolver I

My Sort function is taking the Number Value as Text and not as Values

Hi All,

My Sort function is taking the Value digits as text and sorting them as text and not as real Values.

 

Example

100

100000

222

333

 

and not as

100

222

333

100000

 

Any ideas on what I can try to fix this?

3 REPLIES 3
Drrickryp
Super User II
Super User II

Multiply it by*1

mahoneypat
Solution Sage
Solution Sage

You could use AddColumns to convert your text to numbers and sort by that.  In the example below, a table of numbers as text are converted to numbers with Value for sorting (confusing but the name of the column of the initial table is also called Value).

 

SortByColumns(AddColumns(["100", "1", "22", "33"], "numbers", Value(Value)), "numbers", Descending)

 

Regards,

Pat

Joorge_c
Resolver I
Resolver I

Thanks for the replies, I think I know what the issue is

 Im using a switch in the Sort which takes the UpdateContext of the Sort Icon OnChange of varSortG1 and denote the value, which then assign the sorting column. All sorting columns are Text, except for the 'Contract Amount' one with the issue. But if I swap the 'Contract Amount' at 1st, the sorting works on the Digits without issues.

 

Sort(
Filter(
CurrentR,
Entity_x0020_Adjust_x0020_for_x0020_S_x0020_Branches= Entity.Text
&& Agreement_x0020_Type = Dropdown_AgreementType_PSA.SelectedText.Value
),
Switch(varSortG1,"AName",Agreement_x0020_Name,"LOB",LOB,"ANumber",Agreement_x0020_Number,"Account",Bill_x0020_to_x0020_Account_x0020_Name,"CAmount",Contract_x0020_Amount),
Switch(varSortOrder1,true,SortOrder.Descending,false,SortOrder.Ascending)
)

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (3,284)