• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Filtering two coluums in same or separate steps|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Filtering two coluums in same or separate steps|Power Query|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryFiltering two coluums in same or se…
sp_PrintTopic sp_TopicIcon
Filtering two coluums in same or separate steps
Avatar
Cedric McKeever
Member
Members
Level 0
Forum Posts: 15
Member Since:
January 20, 2019
sp_UserOfflineSmall Offline
1
November 29, 2019 - 4:59 am
sp_Permalink sp_Print

I have the following table that I filtered in Power Query on the column “Jockey”.

 

DATE RACE HORSE HORSE NO JOCKEY ML
11/29/2019 4 Rio Vista 7         Angel  Castillo 6/1
11/29/2019 3 My Man Elvis 4         Angel  Castillo 5/2
11/29/2019 1 Valiant Spirit 4         Angel  Castillo 10/1
11/29/2019 5 Ring Necked 8         Angel  Castillo 8/1
11/29/2019 8 Shanghai Superfly 1         Frankie  Pennington 3/2
11/29/2019 7 She's Primo 7         Frankie  Pennington 5/1
11/29/2019 8 Zoomer 1A         Frankie  Pennington 3/2
11/29/2019 6 Not in the Mood 5         Jann N. Hernandez 7/2
11/29/2019 1 Lemon Crush 1         Jann N. Hernandez 4/1
11/29/2019 2 Spider Jorgensen 4         Jann N. Hernandez 3/1
11/29/2019 3 Vorian 5         John  Bisono 9/2
11/29/2019 8 He's Incredible 3         John  Bisono 4/1
11/29/2019 5 Banker's Island 10         John  Bisono 10/1
11/29/2019 7 Di 1         John  Bisono 2/1
11/29/2019 8 Bojingle 5         Mychel J. Sanchez 3/1
11/29/2019 1 Creative Princess 6         Mychel J. Sanchez 8/1
11/29/2019 7 Dance and Dance 6         Mychel J. Sanchez 7/2
11/29/2019 4 Imperial Lady 2         Mychel J. Sanchez 8/1

 

I also need to filter the table by column “Race” in race number order (ascending) keeping the “Jockey” order so it looks as below.

 

DATE RACE HORSE HORSE NO JOCKEY ML
11/29/2019 1 Valiant Spirit 4  Angel  Castillo 10/1
11/29/2019 3 My Man Elvis 4  Angel  Castillo 5/2
11/29/2019 4 Rio Vista 7  Angel  Castillo 6/1
11/29/2019 5 Ring Necked 8  Angel  Castillo 8/1
11/29/2019 7 She's Primo 7 Frankie  Pennington 5/1
11/29/2019 8 Shanghai Superfly 1 Frankie  Pennington 3/2
11/29/2019 8 Zoomer 1A Frankie  Pennington 3/2
11/29/2019 1 Lemon Crush 1 Jann N. Hernandez 4/1
11/29/2019 2 Spider Jorgensen 4 Jann N. Hernandez 3/1
11/29/2019 6 Not in the Mood 5 Jann N. Hernandez 7/2
11/29/2019 3 Vorian 5  John  Bisono 8/1
11/29/2019 5 Banker's Island 10  John  Bisono 7/2
11/29/2019 7 Di 1  John  Bisono 3/1
11/29/2019 8 He's Incredible 3  John  Bisono 8/1
11/29/2019 1 Creative Princess 6 Mychel J. Sanchez 8/1
11/29/2019 4 Imperial Lady 2 Mychel J. Sanchez 8/1
11/29/2019 7 Dance and Dance 6 Mychel J. Sanchez 7/2
 11/29/2019 8 Bojingle 5 Mychel J. Sanchez 3/1

 

Can this be done in Power Query?  I searched around the internet, but I could not find where you could filter “Race” while keeping “Jockey” in order.  I didn’t get a chance to dig into Mynda’s last video to see if that would apply.  If it did, let me know and I’ll work on it.

 

Code to select Jockeys:

= Table.SelectRows(#"Renamed Columns", each ([JOCKEY] = "        Angel  Castillo" or [JOCKEY] = "        Frankie  Pennington" or [JOCKEY] = "        Jann N. Hernandez" or [JOCKEY] = "        John  Bisono" or [JOCKEY] = "        Mychel J. Sanchez"))

 

Code to sort Jockeys:

= Table.Sort(#"Filtered Rows",{{"JOCKEY", Order.Ascending}})

sp_AnswersTopicSeeAnswer See Answer
Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4449
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
November 29, 2019 - 4:08 pm
sp_Permalink sp_Print

Hi Cedric,

Sort the jockey column, then click on the race column and sort it. That will perform a 2 column sort. You should see a small 1 in the jockey column header and a small 2 in the race column header.

Mynda

sp_AnswersTopicAnswer
Answers Post
Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
3
November 30, 2019 - 1:10 am
sp_Permalink sp_Print

Or, you can manually edit the formula:

= Table.Sort(#"Filtered Rows",{{"JOCKEY", Order.Ascending}}) will be:

= Table.Sort(#"Filtered Rows",{{"JOCKEY", Order.Ascending},{"Race", Order.Ascending}})

Avatar
Cedric McKeever
Member
Members
Level 0
Forum Posts: 15
Member Since:
January 20, 2019
sp_UserOfflineSmall Offline
4
November 30, 2019 - 6:46 am
sp_Permalink sp_Print

Hi Mynda and Catalin,

Thank you both for taking time to reply.  Both are perfect answers and both of you are the greatest.

I knew there had to be a simple answer to my question because Power Query is such a powerful program.

Wishing both of you the best for the upcoming holiday season, and Live Long and Prosper.

Cedric

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Sonja Mason, Alexandra Radu, Denise Lloyd
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Raj Mattoo
Mark Luke
terimeri dooriyan
Jack Aston
AndyC
Denise Lloyd
michael serna
mashal sana
Tiffany Kang
Leah Gillmore
Forum Stats:
Groups: 3
Forums: 24
Topics: 6219
Posts: 27276

 

Member Stats:
Guest Posters: 49
Members: 31903
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.