Differences between excel and power query sorting results

Wishmaster89

Board Regular
Joined
Jan 10, 2022
Messages
77
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
Hi All

I've been playing around with sorting in excel and power query. Power query gives me the result i expect and excel doesn't and i can't figure out why.

Sample data

status to check for QAR comparison 18-09.xlsx
ABCDEFG
1ULNCompletion_StatusLearning_OutcomeStandard_DescriptionLearning_Start_DateLearning_Planned_End_DateLearning_Actual_End_Date
2119Credit Controller / Collector16/08/2017 00:0015/02/2019 00:00
3121Credit Controller / Collector16/08/2017 00:0015/02/2019 00:00
4121Credit Controller / Collector16/08/2017 00:0015/02/2019 00:0020/06/2019 00:00
test_v4


M query for the sort
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="test_v4"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ULN", Int64.Type}, {"Completion_Status", Int64.Type}, {"Learning_Outcome", Int64.Type}, {"Standard_Description", type text}, {"Learning_Start_Date", type datetime}, {"Learning_Planned_End_Date", type datetime}, {"Learning_Actual_End_Date", type datetime}}),
    #"Sorted Rows" = Table.Sort(#"Changed Type",{{"Learning_Start_Date", Order.Ascending}, {"Learning_Planned_End_Date", Order.Ascending}, {"Learning_Actual_End_Date", Order.Ascending}})
in
    #"Sorted Rows"


Now with the same data in the excel sheet, if i replicate the sort in excel like in the attached image the data comes out like this(Column G value changes row). Any one able to tell me why please?

status to check for QAR comparison 18-09.xlsx
ABCDEFG
1ULNCompletion_StatusLearning_OutcomeStandard_DescriptionLearning_Start_DateLearning_Planned_End_DateLearning_Actual_End_Date
2121Credit Controller / Collector16/08/2017 00:0015/02/2019 00:0020/06/2019 00:00
3119Credit Controller / Collector16/08/2017 00:0015/02/2019 00:00
4121Credit Controller / Collector16/08/2017 00:0015/02/2019 00:00
test_v4






excel sort example.PNG
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top