How to sort multiple columns using the M Language in Power Query

preview_player
Показать описание
In today's video I am going to show you how to sort multiple columns at once in Power Query. #curbal #powerquery #powerbi

SUBSCRIBE to learn more about Power and Excel BI!

Our PLAYLISTS:

☼☼☼☼☼☼☼☼☼☼

POWER BI COURSES:

Want to learn Power BI? How about you take one of our courses? Here you can find the available courses:

☼☼☼☼☼☼☼☼☼☼

ABOUT CURBAL:

************

************

QUESTIONS? COMMENTS? SUGGESTIONS? You’ll find me here:
Twitter ► @curbalen, @ruthpozuelo
Рекомендации по теме
Комментарии
Автор

Sorry, but you can accomplish the same with the GUI by sorting on first column, then sort again on the second column. It combines the two sorts into one step. :). Just tried on a test sheet.

MilhouseBS
Автор

I speak of Brazil, I looked for this help a lot I am very grateful, God bless!

rodrigomdfranca
Автор

Easy, quick and superuseful. My favorites! Thank you.

joangarcia
Автор

Hi Curbal, thanks for this video very helpful!

To add to this, e.g. for the folks that also want to have the table sorted in the 'Table Visual':

1) First sort the table in the query editor as explained in the video
2) Hereafter go to 'Add column' and add an 'Index Column'
3) Click apply
4) Create your visual (e.g. Table) add the Index Column and sort on Index.

In addition, I learned that the newest version of Power BI now has a built in feature to sort on multiple columns (shift+click), I will update and check it out soon.

shakeelmusicdotcom
Автор

Ruth, It is not necessary to edit the M code. If you sort by the first column and then during the same step you sort by an another column, the same M code is created showing the two columns on the same step such as:

= Table.Sort(#"Changed Type", {{"Company State", Order.Ascending}, {"Company City", Order.Ascending}})

charliemather
Автор

Thanks a lot, a bog hug from colombia 🇨🇴🇨🇴🇨🇴🇨🇴

diegolozano
Автор

You are the G.O.A.T! Thank you so much!

fernandoatlahuarockefeller
Автор

it did work for me, even I deleted columns after and it kep the sort, Thank you!!!

russo
Автор

Thanks Curbal, I saw that the version Mar 2020 can do Shift+left click but I am using Sep 2019 in my work laptop so your video helped!

dinadulce
Автор

Muy bueno Ruth! Muchas Gracias!, te saludo desde Houston
-Jose

joseblazquez
Автор

Thanks! That is what I was looking for!

JoshLundmark
Автор

what a fantastic tip! thank you so much Ruth !

giovani
Автор

Awesome mam keep posting M language tricks 😀

gagansingh
Автор

Hi Ruth, we can select multiple columns with holding "Ctrl" button to sort multiple column.

madiakns
Автор

Hi Curbal,
I think when we are sorting multiple columns we need to add Table.Buffer(Table sorting M Code) in the M code otherwise it won't do sorting properly. Do a video on Lazy Evaluation concept in power Query

sadinenim
Автор

Hi Curbal, How to remove the sort option? I want the table to be displayed as same as how it is in source file. Please answer..

saravanapriyasivakumar
Автор

Useful tips as usual, thank you.
Naji K.

Bigsarl
Автор

Nice Trick! i’ll record in portuguese in my channel for brasilians learning it! i’ll give your credits!

MaisQuePlanilhas
Автор

Hi Ruth, I’m made the sort change in power query, clicked close/apply, but when I create a new Table Visualization, it still only sorts one column at a time. Am I missing a step?

longgnolgmail
Автор

Rather than writing or copying and pasting and then changing the column name, why don't you just sort the columns one by one to save time? Is there any particular reason not to do this?

Curious to know about it. TIA.

KamranMumtazAhmed